Can’t shoot a _blank at a target?

Having an XHTML Strict DOCTYPE (as in many WordPress themes) invalidates the use of the very useful target="_blank" tag inside an anchor reference to open the page in a new window or tab… but there is a simple work around:
Replace the “target=” part in:
<a href="http://admaris.com" target="_blank">
with an “onclick=” part like:
<a href="http://admaris.com" onclick="window.open(this.href); return false;">.
Don’t forget the return false so the onclick takes precedence over the regular href action. It is a bit uglier to be sure, but it does the job without scripting!

This entry was posted in Technical and tagged , . Bookmark the permalink.

Comments are closed.