Open All External Links into New Tab in Blogger

Open All External Links into New Tab in Blogger


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 brothers and sisters. 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!
Share on Google Plus

About Unknown

    Blogger Comment
    Facebook Comment

0 commentaires:

Enregistrer un commentaire