Log in

View Full Version : XHTML - target="_blank"



nikomou
01-20-2009, 01:45 PM
Hello,

Just wondering whats the best alternative to target="_blank" on XHTML strict webpages?

I know of a few alternatives using javascript, is there any other option? Also, is it possible to open a new tab using javascript? and if the user's browser doesnt support tabs, it would open a new window?

Thanks for your help..

rangana
01-20-2009, 01:57 PM
target="_blank" will validate only on transitional DTD.

If you're wanting it to validate, then your best bet would be JS (window.open()).

...and if user's have JS disabled, give them the option to decide - they'll surely click the link, or do right-click and "open a new tab".

Twey
01-20-2009, 02:04 PM
This was removed from the specification because you shouldn't have control over the windows that appear on the user's desktop. If the user wants to open a new window or tab, then let the user right-click your link and choose to open one.

I wouldn't use XHTML on the Web right now — IE does not support it and will display a download dialogue box instead of rendering your page.

jscheuer1
01-21-2009, 02:21 AM
There are many alternatives to target="_blank". But, just as there are so many reason that one might want to use it in the first place, there are many alternatives. In many, many cases, one should as Twey says just let the user decide. However, there are good alternatives in cases where, say - you want to pop up some content for aesthetic reasons. As long as you do so in a way that will allow the non-javascript enabled user to navigate to any important content presented in this way, some sort of modal window like Lightbox may be good, in fact preferable.

What exactly are you doing?