lime icon

Phosphorus and Lime

A Developer's Broadsheet

This blog has been deprecated. Please visit my new blog at klenwell.com/press.
HTML: XHTML links
This is one of those things I keep having to look up. It involves the old target attribute you use in <a> links to open the link in a new window. This attribute is deprecated in XHTML strict and HTML 4.0 -- or so I hear.

Here, in any event, is the workaround:

onclick="window.open(this.href,'_blank');return false;"


So this:

<a href="http://www.flametag.com" target="_blank">flametag.com</a>


Would become this:

<a href="http://www.flametag.com" rel="external" onclick="window.open(this.href,'_blank');return false;">flametag.com</a>


(The rel attribute is not necessary but can be used for javascript functions to the same effect.)

credit: phpfreaks.com

keywords: link, links, anchor, blank, _blank, target, xhtml