Launching New Browser Window

What’s the trick to making all external links on your site launch in a new browser window?

I have coded target="_blank" in the past, but I was told that it’s no longer supported by W3C.

This forum handles external links the way I would like to.

sitepoint - New-Window Links in a Standards-Compliant World

And its using the target="_blank" method. This forum is not an example of standards-compliant Web development =)

W3C Markup Validation Service results

:cool: Perl / MySQL / HTML CSS

I have Mozilla configured to reject attempts to open new browser windows, anyway, so the links in this forum open in the same window.

– Dan

Oh and ardco and dtobias are pointing out that the web developer does not have much say in whether the web page replaces the current one, opens in a new window (pop-up or tab), or pretty much at all (blocked). For a public audience I would not count on links being opened in anything but the current window. If you designed some fancy Web App, it might be OK - for example phpMyAdmin has a pop-up window you can use for entering queries, but it is an optional feature.

:cool: Perl / MySQL / HTML CSS

Specify either HTML 4.01 Transitional or XHTML 1.0 Transitional as your DOCTYPE, and your pages will be perfectly valid when using the target attribute

Even though it’s not supported (along with other base tags I guess) by W3C doesn’t mean it won’t continue to work. It’s certainly preferable to using javascript, imop.

Of course, I’m always cautioning my students to be judicious with opening new windows. Its pretty annoying, except if you’re trying to escape out of frames.

I posted a reply to this yesterday, but I guess it didn’t take because of the ‘problems’ DH was experiencing.

Thank you everyone for your responses, especially for the Sitepoint article link. I plan on playing with it.

I know there are very few guarantees about design and you don’t always get what you want. However, configuring browsers is something that the majority of ‘average’ site visitors don’t do, so launching a new browser window is typically safe for the sites I do (not a strong Slashdot contingent).

I generally don’t like pop-ups, but I feel that ‘resources’ (ex: a citation in the middle of an article) on a website fall into a special exemption. It’s not like I’ve got entrance or exit consoles that are hijacking page views to someplace they never agreed… I’m just trying to keep eyes on my site so while they go explore they don’t forget what they were doing in the first place.

As a user, if I want to open pages in a new window, I’m perfectly capable of using the right-click option to do so (but generally prefer to use the new-tab option in Mozilla), at least unless the site developer manages to disable right-clicks (which, fortunately, Mozilla is now adding a configuration option to make it ignore).

Some more commentary:

– Dan