This script is quite simple, such as jquery, which is used to perform checks on the external links in a web page and then inject a target = "_blank" on any external links found on the page. So actually this script not only works on Blogger, but it can be in a variety of platforms websites / blogs, such as WordPress (although you will find a similar plugin with ease).
How to Add Script Opener Automatic External Link
Just follow these simple steps:

<script src='http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js' type='text/javascript'></script>(ignore the above script if you already have similar)
<script type='text/javascript'>2 Open the Blogger dashboard> Template> Edit HTML
$(document).ready(function(){$("a[href^='http://']").each(function(){if(this.href.indexOf(location.hostname)==-1){$(this).attr("target","_blank")}});$("a[href^='https://']").each(function(){if(this.href.indexOf(location.hostname)==-1){$(this).attr("target","_blank")}})});
</script>
3 Locate the </ head>
4 Place the script that has been copied just above the </ head>.
5. Save template and done!
You can check external links on blogs that do not have the attribute target = "_blank", or try to create the new external links without target attribute. Check whether the script works.
Short Note: How Scripts Work & Additional Info
If you pay attention to the script, there is a check command twice, namely on the link beginning with http: // and https: // (secure connection protocol), meaning that the script also works on the host and esternal link type that uses a secured connection protocol, such as WordPress and various websites that hosted their own platforms.
Conditional tag (if) is used to apply the requirements / checks the second protocol, and if the value is equal to -1, then the link to look (required) is a link that is not in the same host (not the reply link goes to the website / blog ), aka external (external Links).
Once the links according to the requirements found, it is inserted / injected attribute target = "_blank" [{$ (this) .attr ("target", "_blank")}].
Logically, since the value of -1 means that the link is not in the same host (the link does not go your website / blog), then the value 1 means the opposite (positive values), which if changed from -1 to 1, then all internal links you will open in a new window.
If you want all the links, both internal and external open in a new window (although I do not recommend), do not need to use such a script, simply use the following tags targettting base and put in the head tag (before the </ head>):
<base target = "_blank" />
Check out more in the way of making the link opens a new window / tab.
That's it, and have a nice blogging, fellow brothers and sisters;)
0 Comments:
Posting Komentar
Ada Masukan? Sampaikan Yuk....
Donni Antonius Sinaga