Dan’s latest SimpleQuiz asks the question ‘When using the XHTML 1.0 Strict doctype, how would you launch links in a new window?.’ The problem to overcome is that the
target attribute is deprecated and not available in XHTML 1.0 Strict. We’re not talking about launching a pop-up here, the question alludes to opening a linked PDF in a new window.
target attribute. The answer has to be: don’t use Strict, use Transitional. You require the
target attribute – it isn’t available in your first chose doctype – so use a different doctype. There’s nothing practical to be gained by specifying Strict instead of Transitional, particularly if you code your XHTML as if it’s Strict thereby avoiding deprecated presentational mark-up.
Others are saying use XHTML modularisation and write your doctype with
target included. But, again, I ask why when it is contained in Transitional. Now if you were creating your own elements, perhaps for use with DOM scripting then I would say yes, modularise away. But you’re not.
But why is the
target attribute deprecated in the first place? Surely that’s a mistake by the W3C? The target attribute is required to interoperate framesets. There’s no direction from the W3C that the frameset doctype is either inadvisable or deprecated, after all frames can be useful and indeed preferable in some circumstances. An oddity, but what does it matter? If you’re using frames your pages need to carry a Transitional doctype and you lose nothing for that.
So by now half of you have probably found that I’m using a Strict doctype for this page. Why? Mostly as an intellectual exercise (it is a personal site), partly to eliminate presentational mark-up (good practice) and because I didn’t need any of the deprecated mark-up found only in Transitional.