Open All Web Links, Either Internal or External in New Tab

We have previously published an article to open all external links in new tab, which helped our blog readers to automatically find only external links in their blog and make each of them open in new tab. Now today we’re gonna discuss that how can we make each link in our blog open in new tab, it includes includes internal and external both type of links.

This, a very simple trick is more helpful to increase your overall page views and to reduce bounce rate of blog. Blog bounce rate is one of the important factors in blogging and is simply defined as number of readers leaving your blog without reading any or only one post. It means more the bounce rate lesser the engagement. To prevent your blog readers from leaving your blog without reading any or only one post, you can make all links in your blog open in new tab.

Steps to Open all External Links in New Tab :

  • Go to your blogger dashboard
  • Select your blog >> Template
  • Backup your template before editing
  • Click on “Edit HTML”
  • Find <head> tag in HTML
  • Add <base target=’_blank’ /> code just below the <head> tag, so that it becomes :
<head>
<base target='_blank' />
  • Save your Template, you are all done !!

Now check, your all links will open in new tab.




Now what if you need any specific link to open in same tab??

To make this happen just find hyperlink code of that link in your blog source code and add target=”_self” inside hyperlink, as shown below :

<a href="YourLinkUrl" target="_self">anchor text</a>

Now this particular link will open in same tab and all other links will open in new tab.

If you want just some selected link to open in new tab, not all links :

To make this happen manually find all those links and add target=”_blank” inside a tag in their corresponding hyperlinks, as shown below :

<a href="LinkUrl1" target="_blank">anchor text 1</a>
<a href="LinkUrl2" target="_blank">anchor text 2</a>
<a href="LinkUrl3" target="_blank">anchor text 3</a>

What if you want links from Blogger LinkList Gadget to open in new tab :

To make this happen use search box(Ctrl+f) to find the similar code as below of that gadget you want to change

<li><a expr:href='data:link.target'><data:link.name/></a></li>

Now insert target=”_blank” inside a tag as below :

<li><a expr:href='data:link.target' target="_blank"><data:link.name/></a></li>

Now links associated with modified gadget will open in new tab.

What if you want links generated by any function to open in new tab :

To make this happen use search box(Ctrl+f) to find the function code which may be similar to or quite different as shown below example:

function printRelatedLabels() {
var r = Math.floor((relatedTitles.length - 1) * Math.random());
var i = 0;
document.write('<ul>');
while (i < relatedTitles.length && i < 6) {
document.write('<li><a href="' + relatedUrls[r] + '">' + relatedTitles[r] + '</a></li>');
if (r < relatedTitles.length - 1) {
r++;
} else {
r = 0;
}
i++;
}
document.write('</ul>');
}

Now insert target=”_blank” in code as below :

function printRelatedLabels() {
 var r = Math.floor((relatedTitles.length - 1) * Math.random());
 var i = 0;
 document.write('<ul>');
 while (i < relatedTitles.length && i < 6) {
 document.write('<li><a href="' + relatedUrls[r] + '" target="_blank">' + relatedTitles[r] + '</a></li>');
 if (r < relatedTitles.length - 1) {
 r++;
 } else {
 r = 0;
 }
 i++;
 }
 document.write('</ul>');
 }

Now links generated by this function will open in new tab.

If you want all external links in your blog to open in new tab :

To make all external links in your blog open in new tab, must go through the following article :

If you have any valuable suggestion or modification regarding this post kindly write in comment box.

If this post helped you, please don’t forget to like and share it. You can subscribe us by your email to make every post delivered to you directly in your inbox.




Vikas is an internet geek and founder of Technotraps, a modern tech website. He is a passionate blogger and love to share latest tricks & informations about technology.

  • nice article and some really unique method to explain thanks a lot bro

BlueHost hosting $31/year ***Black Friday Deal***Check Now
Technotraps