XHTML & target attr in <a>

why does sthg like


inside an <a> not validate in XHTML? this attribute can be set with JavaScript, of course, but then how is it supposed to work with JavaScript disabled?

thank you…

I assume you are referring to XHTML 1.0 Strict as in Transitional is it a valid attribute due to Frameset interactivity whereas in Strict is has been dropped.

That is because you should be using unobtrusive JavaScript to spawn a new window.

You should leave it up to the user to decide who may have JavaScript enabled or disabled; whether they prefer a link to open in a new window rather than force them.

Hence if you use JavaScript correctly the link will still function even in the absence of client-side scripting. Hopefully that explains it a little better; give the user the choice.

That’s because the target was left out of the xhtml strict specifications. You can either a) ignore those warnings or b) use javascript to “enhance” the link behaviors

The target attribute is meant to be used with frames, which have been deprecated for over a decade.

Therefore the attribute is deprecated in HTML 4.01 Strict and XHTML 1.0 Strict. It’s still valid in the Transitional DTDs, for compatibility with old-style sites.

The point of using JavaScript instead is that the user can then choose how the link opens, by disabling scripts.