Setting target=“_blank” to external links and standards


/ Published in: JavaScript
Save to your folder(s)

If you want your pages to be valid XHTML-Strict, but you also wish to open external links in new window, the following snippet is doing just that—sets attribute target=“_blank” to all external links in a document to keep your code valid XHTML-Strict. You’ll just have to change variable yourURL. Don’t enter http://www. part of your domain, otherwise something like http://sample.com/ will be treated like any other external link.

URL: http://www.maratz.com/blog/archives/2004/11/29/setting-target_blank-to-external-links/

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.