You just can’t stop learning in a XHTML world.
You just can’t stop learning in a XHTML world.
Jun 23This page is a XHTML 1.0 strict page and I wanted a new window to open on external pages on the previous post
Sadly XHTML 1.0 strict doctypes dont allow blank window’s. Enter good old hacks
Here’s how it is achieved, use the standard
< a href=" yourlink.html " rel="external" .... and use the following snippet to be called on all pages
function externalLinks() {Code from the article at Sitepoint : New-Window Links in a Standards-Compliant World
if (!document.getElementsByTagName) return;
var anchors = document.getElementsByTagName("a");
for (var i=0; i var anchor = anchors[i];i++) {
if (anchor.getAttribute("href") &&
anchor.getAttribute("rel") == "external")
anchor.target = "_blank";
}
}
window.onload = externalLinks;
You just have to be a dynamic HTML in your head or else you will be archived