Saturday 25 January 2014

External Links into New Tab in Blogger Tips and Tricks

External Links into New Tab
Yesterday, I was posted a trick on how to add nofollow attribute to all external links automatically in blogger and today I bring another useful and helpful trick for all my blogger . In this post I will show you that how can we open all external links into new tab. This can be done by adding simple jQuery code into template. Opening external links into new tab help to reduce your blog bounce rate and also you will not lose your valuable visitors. Now you have understood the benefits of opening external links into new tab so let's begin the tutorial.

Open External Links into New Tab

  1. Go to your blogger dashboard >> Edit HTML >> Tick Expand Widget Template Box

  2. Press Ctrl+F and find the below code.
  3. </head>
  4. Now paste the below code above/before it.
  5. <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
    <script type="text/javascript">
    $(document).ready(function () {
    $("a[href*='http://']:not([href*='"+location.hostname+"']),[href*='https://']:not([href*='"+location.hostname+"'])").attr("target","_blank").attr("title","Opens new window").addClass("external");
    });
    </script>

    Note: Remove red line from code if you have already any jQuery.js file in your template.

  6. Save the template.

  7. Done!

Summary!

Always open external links into new tab to prevent your visitors go away from your blog. If your visitors go outside to the external link than it will increase your blog bounce rate and hurt your blog ranking. Try to increase your blog traffic to maintain your blog ranking in search engines

2 comments:

  1. Hey Dear , Its really Important tip,Thanks for sharing this code.Also I have found another solution to open all external links in new tab and make them no-follow from here - https://github.com/rraju007/jQuery-new-taber

    Its detected all external links with domain name so its pretty cool , ha .

    ReplyDelete