DEV Community

loading...
Cover image for Open Links in a New Tab?

Open Links in a New Tab?

zaxwebs profile image Zack Webster ・2 min read

HTML allows you to set links that open in a new tab or window. To do so all you have to do is set the target attribute of a link to '_blank'. But when should you do this? Seems like something people might want to use for external links. Why? It keeps your website open. But is that a good UX pattern?

In general, you should NOT use this pattern.

Why Not?

Alt Text

Breaking Back

The major reason so as to avoid this is it breaks the back button*. And if you care about accessibility that's not ideal.
People who surf with screen readers can have issues with such an approach.

More Steps or Load

By opening links in a new tab for a user you are also increasing the tasks they have to do to go a page back that opened the tab if they wish to do so: Switching the tab and then clicking the back button is more "heavier" than just clicking the back button twice.
Having to close a new tab is also added work for the user.

Tab Clutter

This can also create a lot of tab clutter if this pattern gets chained. Imagine you set to open a link/website in a new tab that does the same and so on.

Notice how the effects mentioned above add to each other. Combined they amplify.

The Popover effect

This one is a bit on the psychological side and perhaps applies to a certain degree only but this pattern can be associated with some fishy websites. I'm sure you've come across at least one that opens tabs with adverts.

When To?

Alt Text
But if this is bad then why does the option even exist? There is a use-case or more. For example, a user is filling in a form and they get to a 'Terms and Conditions' (with a link to the same) check box, you can link such to open in a new tab.

Still Want To?

If you'd still like to proceed with tabs, my advice would be: stay consistent. You can make only external links open in new tab. You can also add an indicator that helps a user associate a certain link style with the tabbing behavior such as with an icon or those that have a specific color.
Again, please consider all the reasons why not to open links in new tabs.

Recent Improvements & Future

Some mobile browsers already allow you to go back off of a new tab. Doing so closes the current tab and switches you to the previous one. Some screen readers notify the user if a new tab was opened. Perhaps, in the future, we will see more improvements in this sector. Until then, here's to a better and more accessible web. Cheers.

Discussion (0)

Forem Open with the Forem app