Jump to content

Is "Target" attribute valid in XHTML 1.0 Strict?


yertle
 Share

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?

Edited by yertle
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>

Edited by Err
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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...