Using jQuery to Open Standards Compliant XHTML Links in New Tabs or Windows
This tutorial will teach you how to use JavaScript to open links in a new tab or window and remain standards compliant.
Using JavaScript to append a target tag does work. It works for the same reason it works to simply put the target attribute in the markup; the browser ignores your document type declaration, regardless of what you set it to be.
Setting target in JavaScript is not using JavaScript to open the window. It is the browser’s interpretation of the target attribute, as defined by non-standard HTML, that opens the window. If the browser were to use actual XHTML standards, it wouldn’t know what to do with a target attribute, whether it was set by the markup or set by JavaScript.
Read More
1100 Fans
2364 Readers
13787 Followers