geeky · non php code


for those who did not know this trick (someone emailed me and asked), I will share it with you here. since xhtml 1.0 strict does not allow the tag target=”_blank” you can still open links in new windows by using the tag rel=”external” to accomplish the same thing. but you will need to link an external js.

create a .js file with the content

function externalLinks() { 
if (!document.getElementsByTagName) return; 
var anchors = document.getElementsByTagName("a"); 
  for (var i=0; i<anchors.length; i++) { 
    var anchor = anchors[i]; 
    if (anchor.getAttribute("href") && anchor.getAttribute("rel") == "external") = "_blank"; 
window.onload = externalLinks;

save & upload it. then link it in your header like any other external javascripts. that’s all 🙂

One thought on “rel="external"

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s