Monday, December 11, 2017

Automatically Open All External Links In New Tab

Links plays a important role in the ranking of a blog or a website as it will be External links or Internal links. Today we are going to share a cool topic with you which is about the blogger external links. External links helps your visitors to go to the described site with is a click But the problem arose when a user click on the external link from your website and it takes him to another site and he leaves your blog or website.

It is most important this in blogging to increase the percentage of the visitors on a blog. And when a visitor leaves your site by clicking any external link and you lose your that user for a time. We are going to share a script with you that will make all the external links open in a new tab and it will not effect your blog’s internal links. You only have to add this script just above your template’s closing skin tag.

How To Open All External Links In New Tab In Website

To make all your external links open in a new tab you just have to follow my steps. And this method will work for both platforms “Blogger & WordPress”

  • Go to blogger template.
  • Click on Edit HTML
  • And search for the Closing Skin tag  ]]>
  • And just above this tag paste the following coding.
  • In WordPress add this code in your themes header.php file.
<script src='' type='text/javascript'></script>
<script type='text/javascript'>
$(document).ready(function() {$("a[href^='http://']").each(
if(this.href.indexOf(location.hostname) ==-1) {
$(this).attr('target', '_blank');
if(this.href.indexOf(location.hostname) == -1) {
$(this).attr('target', '_blank');

After pasting this code in your template save your template and check for some external links And you will found that they are started to opening in a new tab with out any command.

Note: If you already have J Query Script in your template then don’t paste the red colored coding in your template.

Also Read These:

And if you will change the -1 numbers to +1 then it will start opening your all internal links in a new tab.

If you like this post then don’t forget to share it with your friends on social media and subscribe us via email on the right top corner.

About Duryab Aziz

I am Duryab Aziz a computer science student. I love to write and share ideas about Technology, Blogging, SEO and Blogging Tips. I am very passionate about blogging, I am a SEO expert with 4 years of experience in SEO and blogging. I also provide freelancing services such as anything regarding WordPress, any possible issue that you can have, ;) Like Installation, Speeding up WordPress site, On-Page SEO, Off-Page SEO and Article Writing. View my Upwork Profile here.. You can hire me now :) Just drop a single message.

Leave a Reply

Your email address will not be published. Required fields are marked *