Do NOT attach “target” through script!
Friday, July 28th, 2006Using target in (X)HTML Strict. If you need to use the target attribute, either stick with Transitional DOCTYPEs, or add the target attributes dynamically using semantic scripting, e.g. based on semantic class names.
(from http://tantek.com/log/2006/07.html#d27t1218)
NO NO NO NO NO! Your page is just as invalid if you add target in with script as if you put it in your markup.
If you absolutely must open a new window, make it a normal <a href=""> and use window.open() and cancel the default action for the link. But if you weren’t providing any size or chrome info (which are impossible with target anyway), then you don’t have any reason to be opening a window in the first place. Just don’t do it.