Geek Culture
Published in

Geek Culture

Get Links to Open in a New Tab

Photo by That's Her Business on Unsplash

Since I’m working on multiple things at any given time, I am guilty of having multiple browser windows open each with several tabs. Maybe some of you can relate? As I finish projects and research, I do close them but the chaos is never-ending.

If you use Chrome, tab groups are kind of nice but I prefer to keep each subject matter in their own separate window.

Part of the reason I have so many tabs open is because I’ll be looking at a list of something or reading an article that has a links to other pages or sites for more information. Some deep dives require me to lookup multiple sources. And then, I don’t want to close any tabs just in case I need to backtrack through my sources.

While coding, I rediscovered an “Aha!” moment. Ever notice when you click on some links, it will bring you to the new page in that same tab/window? Meanwhile, other links will render the new page in a NEW tab? Or window? Or start up a local web or mobile app and display the information there?

My tab-dependent self has been disappointed too many times from clicking a link that renders the new page in the same tab that I’ve defaulted to right-clicking the link and selecting “Open link in new tab”.

right-click link and select ‘Open link in new tab’

Just in case you’re not understanding my mild disappointment, imagine you’re googling something and want to compare information from the first 2 or 3 results. If you just click on the first link, it will render that page in the same tab. If you start clicking around that site, you lose the ability to immediately go back to the Google search results page. Then, you find the page on the first site with information you’d like to compare to another site on that Google search results page that is now way back in the browser history. You’re creating more work for yourself.

I don’t have the power to make Google search results links to default to opening in a new tab (at least, as far as I know) but, as a developer, I can build this feature into my websites when I feel it would be beneficial to the user by using the HTML ‘target’ attribute.

The ‘target’ attribute specifies where to display the response.

Syntax with a Form
<form target=”_blank”>

Syntax with Link to Different Page
<a href=”” target=”_blank”>Google</a>

w3schools — target attribute values

Although I’m mainly interested in ‘_blank’ that displays the content in a new tab or window, I am curious how the other attribute values would play out and when is a good time and place to use them.



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Jonelle Noelani Yacapin

Jonelle Noelani Yacapin

Certified Sommelier and Flatiron School Software Engineering Grad