Jakob Nielsen has likened the practice of opening links in a new window to a vacuum cleaner sales person who starts a visit by emptying an ash tray on the customer’s carpet.
Now, I wouldn’t say that it’s quite as bad as that, but it can be pretty annoying to click a link and suddenly have a new window appear out of nowhere.
Unfortunately, opening links in a new window is still quite a common occurrence on the Web. Many sites do so now, and I’m sure many will continue to do so. Before you follow their lead, take a few moments to think long and hard about whether it’s the right thing to do.
Why not Open Links in a New Window?
Here are the top 5 reasons why you should beware of opening links in a new window:
- Unless you warn them, Web users are likely to expect the new page to load in the current window. Unexpected surprises can be fun, but not when you’re browsing the Web.
- The act of opening a new browser window resets the back button in that window. The back button is the second most used navigation function (after hyperlinks, source: useit.com), so resetting it is a big no-no.
- To open a new browser window can disorient very novice Web users and the visually impaired. They might not realise that a new window has opened and might struggle to switch between windows.
- Opening a new browser window disrespects the desires of your users. If they want a new window, they’ll ask for one. Don’t force a new window upon users unless there’s a very good reason to do so.
- New browser windows can make an already cluttered taskbar even more difficult to use. We’ve all spent ages hunting through the taskbar in search of the window we want. Don’t make this process even harder by increasing the number of windows the user has open.
But Using New Windows Keeps Users on my Site!
Not on its own, it doesn’t! Web users will stay on a site because it has the information they’re looking for, or because it helps them achieve their goals — not because the browser window is still open.
If users want to return to a Website, they’ll use the back button. If a new window is used, the back button in this window is reset, so users won’t be able to do return to your site using this common method (cue frustrated users).
What Should I do?
The short answer is: think long and hard before you open any link in a new window. If you still think that using a new window is a good idea then you really have two options:
- Warn the user that the link will open in a new window
If you warn the user that the link opens in a new window, it won’t come as a nasty surprise. There are a number of ways you can do warn users:
- Use the href title attribute to let the user know that the link opens in a new window:
- Use text to indicate that the link opens in a new window:
- Use a small icon and text to indicate that the link opens in a new window:
As far as usability and accessibility are concerned, using a text notification with an icon is the best solution. An icon is easier to spot than is text on its own, and the text lets users know what the icon means if they’re unsure. The text will also be picked up by screen readers, so visually impaired users will be warned that the link opens in a new window.
- Provide an icon that opens the link in a new browser window
This solution is used by websites such as Yahoo! and AOL. Yahoo! provides an icon to the right of a hyperlink, which opens the link in a new browser window:
While this is a good idea, as it leaves the choice up to the user, unfortunately it’s a little unclear as to whether the link text (i.e. "SitePoint: New Articles…") opens in a new window or not. This is why it’s important to include text such as "(opens in new window)" if the link text also opens the linked page in a new window.
When can I Open Links in a New Window?
Believe if or not, there are instances when using a new window is a good idea, such as when:
- The link is for a document, such as a PDF or Word file. Opening a new window will allow the image or document to download in the background. It also prevents users from accidentally closing the browser window when they close the document.
- The link is for a large image. In this case, a new window allows the Web user to keep a browser window open while the image is being downloaded.
- The link is for a printable version of an article or Web page. Here, a new window allows users to keep the current window open while they print the article or page in the background.
For each of these instances, use text and an icon to indicate that a new browser window will open:
Think very long and very hard before you open links in a new window. Most of the time, opening links in the current window is by far the best solution. If you do need to open links in a new window, at least warn users beforehand — unless, of course, you want your site visitors to get a rather unwelcome surprise!
Jump Start Git, 2nd Edition
Visual Studio Code: End-to-End Editing and Debugging Tools for Web Developers
Form Design Patterns