Wednesday, June 11, 2014

Open external links in new page on Blogger

Based on the article "Open external links in a new page with Javascript" adapted the script for use in Blogger and automatically open all external links in a new page.
Join the "Template" tab, also called "Design" from the desktop and then to the "Edit HTML" option.
We seek the text:
]]> </ B: skin>
and right after he put:
<script language='javascript'>
var domain = "www.iqdynamicmedia.blogspot.com",
var = domain1 "iqdynamicmedia.blogspot.com",
var script = "javascript: void (0);"
imagenesblogger0 var = "BP0 . blogger.com ";
var imagenesblogger1 = "bp1.blogger.com";
var imagenesblogger2 = "bp2.blogger.com";
var imagenesblogger3 = "bp3.blogger.com";
var blogger1 = "www.blogger.com";
blogger2 var = "www2.blogger.com";
advertising var = "pagead2.googlesyndication.com";
LinksExternos function () {
var External,
if (document.getElementsByTagName ('a')) {
for (var i = 0; ( External = document.getElementsByTagName ('a')); i + +) {
if (
Externo.href.indexOf (domain) == -1 &&
Externo.href.indexOf (domain1) == -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 (advertisement) == -1 &&
Externo.href.indexOf (blogger1) == -1 &&
External . href.indexOf (blogger2) == -1
)
{
Externo.setAttribute ('target', '_blank');
/ / Externo.setAttribute ('class', 'linkexterno');
}
}
}
}
window.onload = function () {
LinksExternos ();
}
</ script>
In the above code and iqdynamicmedia.blogspot.com www.iqdynamicmedia.blogspot.com replaced with the address of your blog (with and without www respectively) and ready.

No comments:

Post a Comment