Web Development

Never Force Links To Open in a New Window

In about 50% of the projects we do, at one point or another are we asked to have all external links open in a new window. Should they? No. They shouldn’t. And here’s why forcing links to open in new windows are (generally) bad practice.

All links on the web may have a parameter called target="blank" which will force the link to open in a new window. Today, through the powers of browser settings, this most often will be a new tab. It stems back to the olden days, when we used to design websites in frames.

For a while, this was marked as invalid in the (X)HTML spec. Nobody really cared about this, because it seemingly worked. And so, with HTML5 it is again valid. But this doesn’t mean you should use it.

But I want users to stay on my site!

This argument makes some sense, but comes at it from the wrong angle. We are making the assumption that users have a much easier time remembering where they came from if we open a new window or tab. It doesn’t have to be the case.

Usually, we end up putting our very own site at a pedestal. Our site is special. Other sites shouldn’t do this, but nobody should leave our site.

Let your users be in control instead and they will thank you for it.

Unfortunately, we are not catering to your specific preference. The default behavior of links on the web is to open in the same window or tab. This is what users will expect. Any change to this is in varying degrees confusing.

The problem is that when you set links to open in new windows, it is very cumbersome for someone to get the default behavior back. In fact, a lot more so than the other way around which requires just a keyboard shortcut.

There must be a very good reason to change the default and expected behavior of a link, and your own preference sadly is not one.

But we are linking outside of our website

Another common argument is that we should have internal links (within our site) be normal, but external links (away from our site) break the standard behavior.

This is even worse from a user experience perspective. See, the user actually has no possible way of knowing what will happen when they click a link. Even if your external links are visually marked, they still have no idea what will happen.

Internal and external links have the same expected behavior. To be opened in the same tab or window.

But my user has started doing something on the page

Bingo! As always there are exceptions to every rule. Any time we have something that the user has initiated, we have a use-case for opening links in a new window.

The inconvenience of loosing that piece of written input, or having that audio clip or video interrupted is great. Here it is better to be safe than sorry by opening relevant links in a new window.

Essentially, we don’t have the back button available here that would return the page to the exact state that the user left it. The inconvenience of having the link open in a new window, is smaller than the inconvenience of loosing your work or your place.