WordPress Safelink – How to Manually Make from JavaScript

What is Safelink Converter ? Safelink is a page on a website or blog that is used to detect whether the intended url link is safe or not from various viruses and malware.

By using safelink, downloading user urls can avoid some viruses being detected. If the site’s file contains data that is harmful to your device then you will be warned by this page not to visit the url link.

Please note, this wordpress safelink version in this tutorial does not have a feature to detected malicious links. This version of Safelink only works to redirect all external links to a special page before leaving the site.

So by using this WP Safelink external link can be redirected to a certain page before leaving the site to another website address, so you can give warning to visitor before go to external link.

This method uses the main blog to serve as a safelink, which uses one of the special pages from main website domain. With this method, site owners can avoid invalid traffic so this can work together with Google Adsense.

You can also apply this tutorial on blogspot or your personal blog which will work 100% because I have also tried to make it myself.

Examples of successful WordPress sites using this type of Safelink, see the Demo that I use on this website to Download the Safelink Blogspot Template for example

Important !
When you visit the converted external link it will lead to the safelink page first to go to the converted url.

WordPress Safelink Video Tutorials

Turn on captions and select Auto Translate to English

To make it easier to follow this tutorial, please see the video above for full details, the steps for making it. If you have trouble, please leave a comment to discuss the problem.

At this time I am willing to accept safelink creation services if you don’t want to bother following this tutorial. For making safelink according to the Video Tutorial Demo, I will give a price $5 USD, payment can be made if the created safelink is successfully run.

How to Create a Safelink in Self Hosted WordPress:

1. Create and Publish a New Page on the website you want to make a safelink, leave it blank first. Example: ‘https://adammuiz.com/link/

Halaman Safelink

2. Download Plugin “Simple Custom CSS and JS” Install and Activate it.

Plugin Simple Custom CSS and JS

3. Open the “Simple Custom CSS and JS” Plugin and create a new JavaScript with the name “link” then add the code below, edit, replace urlhttps://adammuiz.com/link/‘ with the link to the page you created earlier, “Publish“.

//<![CDATA[
var blog = document.location.hostname;
var slug = document.location.pathname;
var ctld = blog.substr(blog.lastIndexOf("."));
var currentURL=location.href;
var str = currentURL;
  var res = str.replace("https://adammuiz.com/link/?url=", "");
$(".Visit_Link").hide();
function changeLink(){
    var decodedString = Base64.decode(res);
    window.open(decodedString,'_self')
}

function generate() {
    var linkDL = document.getElementById("download"),
        linkAL = document.getElementById("download2"),
        btn = document.getElementById("btn"),
        notif = document.getElementById("daplong"),
        direklink = document.getElementById("download").href,
        waktu = 4;
    var teks_waktu = document.createElement("span");
    linkDL.parentNode.replaceChild(teks_waktu, linkDL);
    var id;
    id = setInterval(function () {
        waktu--;
        if (waktu < 0) {
            teks_waktu.parentNode.replaceChild(linkDL, teks_waktu);
            clearInterval(id);
            notif.style.display = "none";
            linkDL.style.display = "inline";
            linkAL.style.display = "inline";
        } else {
            teks_waktu.innerHTML = "<div class='text-danger'>Link will appear in " + waktu.toString() + " Second</div>";
            btn.style.display = "none";
        }
    }, 2000);
}
//]]>

4. Create another new JavaScript using “Simple Custom CSS and JS” with the name “safelink” then add the code below, edit and replace urlhttps://adammuiz.com/link/‘ with the page link you created earlier, “Publish“.

var Base64 = {
    _keyStr: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",
    encode: function (input) {
        var output = "";
        var chr1, chr2, chr3, enc1, enc2, enc3, enc4;
        var i = 0;
        input = Base64._utf8_encode(input);
        while (i < input.length) {
            chr1 = input.charCodeAt(i++);
            chr2 = input.charCodeAt(i++);
            chr3 = input.charCodeAt(i++);
            enc1 = chr1 >> 2;
            enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
            enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
            enc4 = chr3 & 63;
            if (isNaN(chr2)) {
                enc3 = enc4 = 64;
            } else if (isNaN(chr3)) {
                enc4 = 64;
            }
            output = output + this._keyStr.charAt(enc1) + this._keyStr.charAt(enc2) + this._keyStr.charAt(enc3) + this._keyStr.charAt(enc4);
        }
        return output;
    },
    decode: function (input) {
        var output = "";
        var chr1, chr2, chr3;
        var enc1, enc2, enc3, enc4;
        var i = 0;
        input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");
        while (i < input.length) {
            enc1 = this._keyStr.indexOf(input.charAt(i++));
            enc2 = this._keyStr.indexOf(input.charAt(i++));
            enc3 = this._keyStr.indexOf(input.charAt(i++));
            enc4 = this._keyStr.indexOf(input.charAt(i++));
            chr1 = (enc1 << 2) | (enc2 >> 4);
            chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
            chr3 = ((enc3 & 3) << 6) | enc4;
            output = output + String.fromCharCode(chr1);
            if (enc3 != 64) {
                output = output + String.fromCharCode(chr2);
            }
            if (enc4 != 64) {
                output = output + String.fromCharCode(chr3);
            }
        }
        output = Base64._utf8_decode(output);
        return output;
    },
    _utf8_encode: function (string) {
        string = string.replace(/\r\n/g, "\n");
        var utftext = "";
        for (var n = 0; n < string.length; n++) {
            var c = string.charCodeAt(n);
            if (c < 128) {
                utftext += String.fromCharCode(c);
            } else if ((c > 127) && (c < 2048)) {
                utftext += String.fromCharCode((c >> 6) | 192);
                utftext += String.fromCharCode((c & 63) | 128);
            } else {
                utftext += String.fromCharCode((c >> 12) | 224);
                utftext += String.fromCharCode(((c >> 6) & 63) | 128);
                utftext += String.fromCharCode((c & 63) | 128);
            }
        }
        return utftext;
    },
    _utf8_decode: function (utftext) {
        var string = "";
        var i = 0;
        var c = c1 = c2 = 0;
        while (i < utftext.length) {
            c = utftext.charCodeAt(i);
            if (c < 128) {
                string += String.fromCharCode(c);
                i++;
            } else if ((c > 191) && (c < 224)) {
                c2 = utftext.charCodeAt(i + 1);
                string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
                i += 2;
            } else {
                c2 = utftext.charCodeAt(i + 1);
                c3 = utftext.charCodeAt(i + 2);
                string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
                i += 3;
            }
        }
        return string;
    }
}
var encode = document.getElementById('encode'),
    decode = document.getElementById('decode'),
    output = document.getElementById('output'),
    input = document.getElementById('input');
var User_ID = "";
var protected_links = "";
var a_to_va = 0;
var a_to_vb = 0;
var a_to_vc = "";

function auto_safelink() {
    auto_safeconvert();
}

function auto_safeconvert() {
    var a_to_vd = window.location.hostname;
    if (protected_links != "" && !protected_links.match(a_to_vd)) {
        protected_links += ", " + a_to_vd;
    } else if (protected_links == "") {
        protected_links = a_to_vd;
    }
    var a_to_ve = "";
    var a_to_vf = new Array();
    var a_to_vg = 0;
    a_to_ve = document.getElementsByTagName("a");
    a_to_va = a_to_ve.length;
    a_to_vf = a_to_fa();
    a_to_vg = a_to_vf.length;
    var a_to_vh = false;
    var j = 0;
    var a_to_vi = "";
    for (var i = 0; i < a_to_va; i++) {
        a_to_vh = false;
        j = 0;
        while (a_to_vh == false && j < a_to_vg) {
            a_to_vi = a_to_ve[i].href;
            if (a_to_vi.match(a_to_vf[j]) || !a_to_vi || !a_to_vi.match("http")) {
                a_to_vh = true;
            }
            j++;
        }
        if (a_to_vh == false) {
            var encryptedUrl = Base64.encode(a_to_vi);
            a_to_ve[i].href = "https://adammuiz.com/link/?url=" + encryptedUrl;
            a_to_ve[i].rel = "nofollow";
            a_to_vb++;
            a_to_vc += i + ":::" + a_to_ve[i].href + "\n";
        }
    }
    var a_to_vj = document.getElementById("anonyminized");
    var a_to_vk = document.getElementById("found_links");
    if (a_to_vj) {
        a_to_vj.innerHTML += a_to_vb;
    }
    if (a_to_vk) {
        a_to_vk.innerHTML += a_to_va;
    }
}

function a_to_fa() {
    var a_to_vf = new Array();
    protected_links = protected_links.replace(" ", "");
    a_to_vf = protected_links.split(",");
    return a_to_vf;
}

5. Create CSS using “Simple Custom CSS and JS” with the name “csslink” then “Publish“.

.btnlink{
    top:50%;
    background-color:#002ead;
    color: #fff;
    border:none; 
    border-radius:10px; 
	padding: 8px 32px;
	text-align: center;
	text-decoration: none; 
  }
.btnlink:hover {
      background-color:#088000;
      transition: 0.4s;
	  color: #fff;
  }
.text-danger{
	font-family: 'Brush Script MT', cursive;
	color: blue;
	font-size: 18px;
	font-weight: bold;
	border-style: dashed;
}

After adding Custom CSS from “Simple Custom CSS and JS” plugin, means that you already have 1 CSS and 2 Java Scripts now.

Halaman Safelink

6. Copy code below and Put it in to Template [Location : Wp-Admin > Appearance > Editor > Theme Footer (footer.php) Or Access Edit Template Via CPanel] above </body> code :

Script Safelink
<script src='URL.JS' type='text/javascript'></script>
<script type='text/javascript'>
protected_links = "adammuiz.com,facebook.com,twitter.com,youtube.com";
auto_safelink();
</script>
  • JavaScript Link: Edit and replace the url “URL.JS” with the JavaScript “Safelink” that you add in “Simple Custom CSS and JS” plugin berfore.
  • Protected Link: Edit and replace adammuiz.com with your blog’s url address, and add the url address that you don’t want to convert with safelink by adding (,) to each link. “Save” Templates.

7. Copy and paste the code below into the “Custom HTML” block on the Safelink page that you created earlier. Information :

Custom HTML
<center>
Iklan 1
<script type="text/javascript">
//<![CDATA[
function changeLink() {
    var e = Base64.decode(res);
    window.open(e, "_self")
}
var currentURL = location.href,
    str = currentURL,
    res = str.replace("https://adammuiz.com/link/?url=", "");
document.write('<button target="_self" class="btnlink" style="display: block; font-size:small" id="download" onclick="changeLink()">Continue</button>');
onload: generate();
//]]>
</script>
<script src="URL.JS" type="text/javascript"></script>
Iklan 2
</center>
  • Ads Placement: Replace Ad 1 and Ad 2 with the Ads you want to display.
  • Page Url Code: replace the url “https://adammuiz.com/link/” with your safelink page link.
  • JavaScript Link: Edit and replace the url “URL.JS” with the JavaScript “Safelink” that you created earlier.
Kode Safelink WordPress

After finish make change and modify the code then Save Page.

The tutorial is finished, now you can try by publishing a post with a link. If the steps for making this wp safelink are done correctly, it will automatically convert all external links that are not excluded into an encryption and redirect to a special safelink page that has been created.

The advantage is by using this method you don’t have to bother creating a new blog because SafeLink is on the main domain, besides that SafeLink traffic will also become one with the main blog traffic which will make your pageview increase.

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Download Game Android

Download Flying Slime APK

Flying Slime APK DeveloperYouzu StarsJenis AppAdventure, Offline GameVersi1.1.2 (12)Ukuran62 MBSistem OperasiAndroid DOWNLOAD APK (Google Drive) PLAY STORE (N/A) (Official Link) Riwayat : Versi Lama(Old Version) About Flying Slime for Android Flying Slime...

Artikel Rekomendasi

Mending Deposito atau Reksadana, Pilih Mana

Mending Deposito atau Reksadana, Pilih Mana ?

0
Tingginya minat masyarakat terhadap investasi dalam kurun beberapa tahun terakhir, secara tidak langsung menempatkan investasi sebagai komoditas yang sangat penting. Terbukanya akses terhadap informasi,...

Software Windows Free