Here we can use a script thta will make every external link to open in a new page.
- Go to the “Template” tab, also called “Layout” from the desktop, and then go to “Edit HTML”.
- Search the following text:
- In the last code, replace www.yourblog.blogspot.com and yourblog.blogspot.com for your blog’s address, and that’s it.
]]></b:skin>
and just after this paste the following:
<script language='javascript'>
var dominio = "www.yourblog.blogspot.com";
var dominio1 = "yourblog.blogspot.com";
var script = "javascript:void(0);";
var imagenesblogger0 = "bp0.blogger.com";
var imagenesblogger1 = "bp1.blogger.com";
var imagenesblogger2 = "bp2.blogger.com";
var imagenesblogger3 = "bp3.blogger.com";
var blogger1 = "www.blogger.com";
var blogger2 = "www2.blogger.com";
var publicidad = "pagead2.googlesyndication.com";
function LinksExternos() {
var Externo;
if (document.getElementsByTagName('a')) {
for (var i = 0; (Externo = document.getElementsByTagName('a')[i]); i++) {
if (
Externo.href.indexOf(dominio) == -1 &&
Externo.href.indexOf(dominio1) == -1 &&
Externo.href.indexOf(script) == -1 &&
Externo.href.indexOf(imagenesblogger0) == -1 &&
Externo.href.indexOf(imagenesblogger1) == -1 &&
Externo.href.indexOf(imagenesblogger2) == -1 &&
Externo.href.indexOf(imagenesblogger3) == -1 &&
Externo.href.indexOf(publicidad) == -1 &&
Externo.href.indexOf(blogger1) == -1 &&
Externo.href.indexOf(blogger2) == -1
)
{
Externo.setAttribute('target', '_blank');
//Externo.setAttribute('class', 'linkexterno');
}
}
}
}
window.onload = function() {
LinksExternos();
}
</script>
Lee este artículo en español: Abrir los links externos en una nueva página en Blogger.
Tchock September 14, 2010 at 3:00 pm
Hi! i tried this but it open the enternal links too -_- can u help me out with another code 🙂
kshitij January 15, 2011 at 3:38 am
it works fine. i really liked it. I’m a newbie blogger. I need ur expert suggestions for customizing my blog. Please leave a reply.
thanx
Shruthi November 5, 2011 at 3:32 am
thank you!! I have been cracking my head over this for a while now. this really helped!! 🙂