Monday, July 2, 2018

How To Make Blogger Posts With The External Links Open In New Tabs

ad300
Advertisement
  • Follow These Steps:-

  • Go to your blogger dashboard
  • Select your blog >> Template
  • Backup your template before editing
  • Click on “Edit HTML”
  • Find </head> tag in HTML
  • Add the following piece of code just above the </head> tag
  • Save your Template, you are all done !!
Note : Please don’t add the red code if you already have jQuery library source code installed on your blog.

 <script src='http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js' type='text/javascript'></script>


 <script type='text/javascript'>
 $(document).ready(function() {
 $("a[href^='http://']").each(
 function(){
 if(this.href.indexOf(location.hostname) == -1) {
 $(this).attr('target', '_blank');
 }
 }
 );

 }
 }
 );
 });
 </script>

Affected Links By Above jQuery Script:

Above jQuery script will check all hyperlinks inside your blog pages a
The script will only detect external hostnames and the moment it finds one,
it will insert into the html a target attribute that tells the browser to open the link in a new window.

Thanks!


.
Share This
Previous Post
Next Post

I'm All Time a blogger,a scripter,a graphic desginer and blogging is my love and life.If you need any help regarding you may ask in the comment box or email me.

0 comments:

Powered by Blogger.