50+ SEO Optimized Blogger Templates 2016 Free Download

Automatically Open all External Links in a New Tab!

Open all the external links in new tab or new window in blogger. Rather then adding target="_blank"  inside all the outgoing links just add below code and all the links going out from your blog will be open in the new window or new tab. Follow the below steps.
  1. Go to blogger dashboard
  2. Template
  3. Click on Edit Template
  4. Search for </head> tag in the code. and paste below code above it.

<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');
      }
    }
  );
$("a[href^='https://']").each( 
function(){ 
if(this.href.indexOf(location.hostname) == -1) { 
$(this).attr('target', '_blank'); 


);
 
});
</script>
    6. Save the template. 
Don't forget to share it with friends.


Subscribe To Get FREE Tutorials!



Malik Muhammad Aaqib Sohail

Author & Editor

He is Blogger Freelancer, Graphic Designer and Student of Electrical Engineering! You can connect with me on social media! Check About Me Page.



0 Disqus-blogger:

Post a Comment

Social Time

Facebook
Like Us
Google Plus
Follow Us
Twitter
Follow Us
Pinterest
Follow Us

Subscribe to our newsletter

(Get fresh updates in your inbox. Unsubscribe at anytime)