Sunday 7 June 2015

All External Links In a New Window For Blogger

Today i will tell you that how you can open All External links in a new window. So there is a jquery code for that which will make all links to open automaticly in a new window. This Scrips also helps you to prevent blog readers from leaving your blog. It will also increase your visitors and will also decrease your bounce rate. The defination of bounce Rate is that a person is going to visit your blog then suddenly he bounced back without checking any other pages. SO it is better to have lower bounce rate which is good for Seo (Search Engine optimization).


External Links in A New window
So here is the Code. 
1)Go to the blogger 
2)click on template
3)click Edit Html
4)above </head> paste this code


***********
 <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>  

5) Save your Template And enjoy

0 comments:

Post a Comment

 
type='text/javascript'/>