Scatter/Gather thoughts

by Johan Petersson

The folly of target="_blank"

Some web designers think their sites are so important that any external link must be opened in a new browser window and will use a variety of tricks to force these popups to happen. A particularly problematic practice is relying entirely on scripting for doing this, breaking links in the process:

<a href="#" onclick="">evil</a>

<a href="">nasty</a>

Besides being annoying, such links are completely non-functional for user agents that do not support scripting (this includes all search engine spiders I am aware of) or have it turned off. It's possible to keep the links functional with some additional script code or by using the deprecated target attribute:

<a href="" target="_blank">rude</a>

However, no amount of clever (or stupid) tricks will change the fact that forcing new windows to open is disrespectful and hostile to web site visitors. A number of usability studies have shown that experienced web users will find this behaviour annoying and that beginners will get confused by it.

Six years ago web usability expert Jakob Nielsen identified new browser windows as one of the top ten worst new web design mistakes. We're now far beyond the point where this can be called a "new" mistake. Usability consultant Carolyn Snyder explains why it's a problem for non-technical users in Seven tricks that web users don't know and offers this advice:

Avoid spawning multiple browser windows if at all possible — taking the "Back" button away from users can make their experience so painful that it usually far outweighs whatever benefit you're trying to provide. One common theory in favor of spawning the second window is that it keeps users from leaving your site, but ironically it may have just the opposite effect by preventing them from returning when they want to.

Web-savvy users won't find all popups offensive, but extra browser windows are often undesirable and never necessary. Window management is a task that should be left to the user rather than the web designer or developer – everyone already know how to use the back button and experienced users are perfectly able to open new windows explicitly when desired, e.g. by shift-clicking on a link or using ctrl+n.

If you are using Firefox the default behaviour can be modified to consistently open links in the current window. As of Firefox 1.0.1 the default options dialog doesn't allow you to do this, although the relevant settings can be accessed through the browser by entering about:config in the location bar.

Locate browser.tabs.showSingleWindowModePrefs and set this value to true. The Advanced tab in the options dialog will now show a new option, Force links that open new windows to open in, with a checkbox and two radio buttons. The user interface actually reflect the following setting (which can also be changed manually):
1Open in the current window
2Open in a new window (default)
3Open in a new tab determines where links that would normally open in a new window are loaded. Changing it to 1 should not lead to any problems, although the browsing experience might not be entirely satisfactory on sites designed with little consideration for usability and accessibility. The behaviour can be tweaked through a second setting:

0Divert everything (default)
1Divert target="_blank" but not
2Divert everything except with three parameters

In my experience keeping the number of new windows down also makes for somewhat faster browsing, especially if you have browser extensions that need to be initialized for every new window.

15 March, 2005