I was making my rounds on the ol’ Interweb, I stumbled across a nice site (Tim Berners-Lee would be proud at my method of finding stuff by simply following link after link after link, et al.), which happened to be written in XHTML 1.1. My site is written in XHTML 1.0 Strict, and one of the most annoying things about 1.0 Strict is the absence of the
target attribute. I like to link to offsite pages with a
target="_blank" in my anchor tags. This is due to the nature of
target; it goes against the whole idea of separation of presentation, structure and content (HTML has to do with structure, not the control of the window).
HTML 1.1 is like an even more strict version of XHTML 1.0 Strict, so I was astonished when I realized that the site (wadny.com, by the way) had links that opened up in new windows! What the… HOW?!! Granted, you can whip up some js to pop up new windows, but most of those techniques are either blocked by pop-up blockers (as well they should), or make for non-compliant code (in which case, I’d just use XHTML 1.0 Transitional and use the damned
onclick or other js attributes, each linking to code or containing js snigglets… just a simple
rel="external" in each link that was to be external. I was impressed.
So, of course, I integrated it into my own site.
When you see a link like this offsite link to Google, you’ll know you’re getting a new window by either the icon, the tooltip that appears, or even the status bar (well, at least in Safari it says it will open in a new window).
rel="external", the script tells the browser to treat it like it was a
target="_blank". So, with this script loaded in your header, all you have to do is add the
rel="external" to your external links.
If you have any comments or questions, please feel free to comment below.