Tutorial on making safe link within the main website/blog 





Utmost compendiums of this composition presumably formerly know what afterthought is but as a memorial it'll be described then again. 

 In short Afterword, before the stoner goes to the target runner, the excursus link is the website or blog runner that's used to find out if the contagion and malware is defended or not/ target 

 Secure links are frequently set up on blogs websites with downloadable content, but the most common hassle is that they're on the main blog in different disciplines. 

 

 There are numerous disadvantages of this type of raised, but it's insolvable to talk about them then. Safe Link plants a variety of information and marvels to your advantage, and so on the main blog, Safe Link runner has taken the lead thanks to the use of lading composition, perfect for the work we do 

Safelink scripts and Benefits 

 The manner it works is nearly the same as other safelinks, handiest the safelink runner remains on the principle sphere. 

 The script is that when a vacationer solicitations to down load a certain record on a weblog, they'll be directed to a positive web runner from the blog before than eventually heading to the document down cargo web runner. 

There are numerous useful effects to be gained from this interpretation of Safelink, including 

 

  •  No need to produce a new blog and buy a new sphere 
  •  Easier to customize 
  • Stay on the main blog, which means it'll automatically increase the number of callers to the main blog 
  •  Increase blog runners because callers are adding 
  •  Reduce the brio rate for the main blog 
  •  Placing AdSense means adding blog income. 
  • 100 safe because it's still in the same sphere as the main blog 

  •  The disadvantage of this secure link is that it encodes all external links and is directed to the secure link runner, including social media links or other blog links( not download spots), the only way is that you have to add every point that you do not want to be diverted To the secure link inside 

 Safelink tutorials within the main blog 

 This tutorial will be divided into two corridor, the first part is to produce the secure link runner and the alternate part is to edit the source or blog law. We're using blogger because this tutorial is also preferred for blog druggies, other druggies of the service can acclimatize to this tutorial. 


 Step 1- produce a Safelink Page 

 First of all, produce a blog runner, it does not need to be a static runner, the post runner can also be used for this secure link. We assume you formerly understand and can produce the runner, also modify it in HTML View by clicking the pencil icon at the bottom of the title when editing the runner 

We've prepared a template that you can use to layout the secure link runner, so just copy and bury the HTML law below into the secure link runner you created. 


<div class='ad-placement'>
  <!--[ Your_ad_code_here ]-->
</div>

<div class='safelink-button' id='safelink'>
  <div style='text-align: center'>
    <div class='button outline' id='safelink-wait'>Please wait...</div>
    <script>/*<![CDATA[*/ var currentURL = location.href; var str = currentURL; var res = str.replace('https://your_blog_address.com/p/safelink.html' + '?url=', " "); function changeLink(){ var decodedString = Base64.decode(res); window.open(decodedString, '_blank')}; document.write('<a href="#getLink" id="safelink-download" class="button">Create link</a>'); var linkDL = document.getElementById("safelink-download"); var notif = document.getElementById("safelink-wait"); var time = 5; var textTime = document.createElement("span"); linkDL.parentNode.replaceChild(textTime, linkDL); var id; id = setInterval(function () { time--; if (time < 0) { textTime.parentNode.replaceChild(linkDL, textTime); clearInterval(id); notif.style.display = "none"; linkDL.style.display = "inline-block"; } else { textTime.innerHTML = "Link will appear in " + time.toString() + " second"; }}, 1000); /*]]>*/</script>
  </div>
</div>

<div class='safelink-content'>

  <!--[ Write_your_content_here ]-->

</div>

<div class='safelink-create' style='text-align:center'>
  <div class='ad-placement'>
    <!--[ Your_ad_code_here ]-->
  </div>

  <div id='getLink'>
    <a class='button' href='javascript:;' onclick='changeLink();' rel='noreferrer noopener' target='_blank'>Get link</a>
  </div>

  <div class='ad-placement'>
    <!--[ Your_ad_code_here ]-->
  </div>
</div>

Information 


  •  Put your composition and Adsense law in the given section. The recommended size of the applicable adsense is the size. 
  •  Do not forget to copy the url/ link you created before and replace the given url with" https//your_blog_address.com/p/safelink.html" with the url of the secure link runner. 
  • You can also change the judgment on the link button according to your solicitations by changing the judgment " Get link"," Please stay." and other stressed textbook. 
  •  The number 5 in the law over is the time parameter( in seconds) to display the destination link, you can change it to be briskly or pokily. You can also customize the textbook of the time that appears by changing the" Link will appear in the Alternate" section. 
  •  It's recommended that your blog supports" https" as this will affect the experience of the callers and affect the functionality of the script. 
  •  Save the runner you're ignoring if there's an error communication" Your HTML can not be accepted end label BUTTON" or analogous by clicking close announcement, until the first stage completes then and please do to the alternate stage. 

 

 Step 2- Add some CSS and Javascript Code 

 
It should be noted that this alternate part is going to be a bit complicated so look precisely because if there's a slight error the secure link won't work 

 Please edit your form in Edit HTML mode In short, please click on the content and click on Edit html as shown in the image below; If you need to coagulate the template first to avoid editing crimes. 

 Adding CSS law 

 This CSS law serves to display the layout on the safelink runner that was created in the early stages. 



/* Safelink */
:root {
--link-outline-color: #48525c ;
--link-bg-color: #204ecf ; // Warna background tombol link
}

.button{display: inline-flex;align-items: center;margin: 15px 15px;padding: 10px 20px;outline: 0;border: 0;border-radius: 2px;color: #fefefe;background-color: var(--link-bg-color);font-size: 14px;white-space: nowrap;overflow: hidden;max-width: 100%;line-height: 2em}
.button.outline{color: var(--link-outline-color);background-color: transparent;border: 1px solid #ebeced}
.button.outline:hover{border-color: var(--link-bg-color)}
.safelink-button, .safelink-create > *{margin: 1.8em 0}
.safelink-button span{display: block;font-size: 12px}
#getLink{margin: 5px 0}
#getLink .button{display: none}
#getLink:target .button{display: inline-flex}
You can edit this section such as changing the text size on links or so on.
In Blogger the CSS code is marked with the <b:skin>...</b:skin> tag. If it is difficult to place the CSS code above, you can find the </head> code and place the CSS code right above the </head> code with a note that you must use the <style>...</style> code. The result is something like this:

  <style>
    <!--[ Isi Kode CSS diatas ]-->
  </style>
</head>

Sometimes the </head> code is not found in certain templates , instead you can look for code like this: </head> or <!--<head/>--></head>

Javascript for Redirect ?m=1


Find the </head> code on your blog and place the code below just above the </head> code :

<b:if cond='data:view.isPage'>
  <script>/*<![CDATA[*/ var uri = window.location.toString(); if (uri.indexOf("?m=1","?m=1") > 0) {var clean_uri = uri.substring(0, uri.indexOf("?m=1"));window.history.replaceState({}, document.title, clean_uri); }; var protocol = window.location.protocol.replace(/\:/g,''); if(protocol == 'http'){ var url = window.location.href.replace('http','https'); window.location.replace(url);} /*]]>*/</script>
</b:if>

The code above serves to remove the code ' &m=1 ' which usually appears when the page is accessed via mobile, because if the code ' &m=1 ' is not removed then the safelink will not work when visitors access it via the mobile platform. This code also works to redirect visitors via ' http ' to ' https '. If your blog has not been set to support ' https ' then you can delete the part that has been color-blocked in the code above:

var protocol = window.location.protocol.replace(/\:/g,''); if(protocol == 'http'){ var url = window.location.href.replace('http','https'); window.location.replace(url);}

Blogs that are set in ' http ' mode will not work if they are opened via ' https '.

Javascript Code to Encode Url

This script serves to change all external links on the blog to Base64, after adding the script below all external links will be automatically encoded as in the example below:

https://www.miusm-tech.com/p/safelink.html?url=aHR0cHM6Ly93d3c2NS56aXBweXNoYXJlLmNvbS92L3F3V1FhTDdWL2ZpbGUuaHRtbA

The easiest way to place javascript code is to place it before the </body> tag . Look for the tag usually at the bottom of the template and paste the Javascript code below right before the </body> tag .

<b:if cond='data:view.isSingleItem'>
  <script>/*<![CDATA[*/ 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 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 daftarPostingan = [ "https://your_blog_address.com/p/safelink.html" ]; var randomPostingan = daftarPostingan[Math.floor(Math.random()*daftarPostingan.length)]; 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("https")) {a_to_vh = true;} j++; } if (a_to_vh == false) {var encryptedUrl = Base64.encode(a_to_vi); a_to_ve[i].href = randomPostingan + "?url=" + encryptedUrl; a_to_ve[i].rel = "noopener noreferrer"; a_to_vb++; a_to_vc += i + ":::" + a_to_ve[i].href + "\n";} } var a_to_vj = ""; var a_to_vk = ""; 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;}; /*]]>*/</script>

  <!--[ Protect link from encode ]-->
  <script>protected_links = "facebook.com, instagram.com, twitter.com"; auto_safelink(); </script>
</b:if>

Change the part marked in the code above with the url of your safelink page

By default all external links will be redirected to the safelink page, add some exclusion sites such as your blog's facebook page and so on in the ' protected_links ' section , separate them with commas ( , ) if you want to add multiple exclusion sites.

 tag <b:if cond='data:view.isSingleItem'> functions to make the script only appear on post pages and is static, will not appear on other pages.

If you have added please click Save Theme in your template.

Adding More Than 2 Safelink Pages:

You can slightly modify the script above so that it can display more than two safelink pages that will be chosen randomly. The trick is to change the code section:
var daftarPostingan = [ "https://your_blog_address.com/p/safelink.html" ];

Add a new url separated by a comma ( , ) so that the code becomes as below; You can also add some other safelink pages

var daftarPostingan = [ "https://your_blog_address.com/p/safelink.html", "https://your_blog_address.com/p/safelink-2.html" ];

This is optional, you can add it or decide to keep using only one safelink page

Up here your safelink page has been completely created, if you follow all the steps correctly then we can guarantee the safelink page is working well. Please try it by clicking the download link on your blog. If there are questions or parts that are not understood, please write questions through the comments column provided.

It's been updated!!
This article has been updated to make it easier to use and has been tested on other blogs, 100% working, if you still find errors there may be something wrong in implementing the code