Jump to content

Is "Target" attribute valid in XHTML 1.0 Strict?


yertle

Recommended Posts

When validating XHMTL 1.0 Stirct Doctype, I get errors concerning the Target attribute.This code validates:

<a href="http://www.w3schools.com/">Visit W3Schools!</a>

Whereas this code does not validate:

<a href="http://www.w3schools.com/"target="_blank">Visit W3Schools!</a>

If in fact the Target attribute is not valid in XHTML 1.0 Strict doctypes, then how does one get a link to open in another window, instead of the parent window?Or, does this stem from problems arising due to links opening in new windows? If so, what problems are being avoided by disallowing links to open new tabs or windows?

Link to comment
Share on other sites

JavaScript. Here's a good solution:

<a href="http://www.w3schools.com/" onclick="window.open(this.href); return false">Visit W3Schools!</a>

Link to comment
Share on other sites

I believe, in the spirit of semantic web, this is one more way of separating content from behavior. It's an odd choice, since a link is a "behavioral" element anyway. But that's my guess.

Link to comment
Share on other sites

Or, does this stem from problems arising due to links opening in new windows? If so, what problems are being avoided by disallowing links to open new tabs or windows?
Well, according to the W3C, until there is a way for user agents to stop links from opening in new windows if the user so desires, then it is preferable to not make links open in new windows and rather let the user make the decision.
Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...