Recent Comments

Write Your Email id than press on Subscribe . You will get all the update via Email by Subscribe us. (Thank You)

Home » Blogger , web design » Automatically open every external links in a new window in your website or Blogger!

Automatically open every external links in a new window in your website or Blogger!




 This method works for both blogger and wordpress blogs, irrespective of platforms.

Automatically open every external links in a new window in your website or  Blogger!

Lets start___________________________________________
Go to Blogger > Template > Backup your template 
Click "Edit HTML"
Just above </head> paste the following script:


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

Than save your template . Ok now all done . 
Please Comment below if you face any problem .

Subscribe Us