May 6, 2004

SimpleQuiz › Part XVI: Launching Windows

This question comes in from Keith Robinson -- and it's a good one. Recently, Keith had been working on a project using the XHTML 1.0 Strict doctype -- but ran into a dilemma when he needed to launch certain links into a new window.

No worries, the target attribute is all we'll need here:

<a href="somewhere.html" target="_blank">link</a>

But sadly, the target is deprecated and unallowed in XHTML 1.0 Strict (probably lumped in with the demise of frames). So we have a few options. We could stick with Strict and use any number of JavaScript methods to pop the new window. Or we could be rebels and use the target attribute, ignoring validation errors. Or lastly, we could switch to the XHTML 1.0 Transitional doctype and use target, staying completely valid.

Q: When using the XHTML 1.0 Strict doctype, how would you launch windows in a new window?

  1. Strict doctype + JavaScript pop-up solution
  2. Strict doctype + target="new" + Ignore validation error
  3. Switch to XHTML 1.0 Transitional doctype + target="new"