This exercise uses the `_blank` value to open pages in new tabs. Does the `target` attribute have other values?

It’s a bit early to be thinking about SEO, but as time progresses it will become more of a concern, especially for a site facing the World Wide Web. As it turns out, target has practically no SEO value unless it affects the quality of the site. It is a bad idea to use the attribute if the URL is to a local site resource. It kills the Back button so the user has no history to fall back on when attempting to return to the page that sent them there. For this reason, it should be reserved only for links to other sites.

Bottom line, use this attribute with great care and deliberation. Do not treat it trivially.

6 Likes

Thank you mtf for your great explanation.

1 Like

Obviously there’s more. Why don’t you link us to them?

It seems, it was the InternetWorks browser (I’ve never heard about it :wink:), but Opera also helped to promote it in the early 2Ks.
Source: Which Browser Invented Tabs? 3 Common Myths Debunked

2 Likes

your reply explains it perfectly, thank you.

1 Like

I noticed something, when there is no target attribute I left click on the link and it bring out options (open in new tab, open in new browser ), my question is if the option can bring out (open in new tab) without adding the target attribute, why do we need the target attribute?

We don’t, really. It is a left over from the very early days of web browsers when the interface was often built around ‘frames’ (something to read up on from the distant past). It’s actually discouraged these days since it can ‘break the back button’ (another thing to read up on).

1 Like

Why no discussion of adding rel=“noopener, noreferrer” to any link with target=“_blank” to prevent exploitation of the newly-opened page by phishing sites via the JS window.opener? Or has that hole been fixed since I learned HTML5? It has been a few years.

Mee too. Awesome! It may seem time-spending but actually, it’s knowledge gain.

How do you give the user control? They can right click and choose for themselves if it opens in a new tab, window etc. How would you decide what gives a better user experience? I can imagine it might be annoying to some users to have new tabs open for every link.

Yes, and confusing for some. It goes against accessibility and furthermore, ‘breaks the Back button’. This is what ‘intermodal’ is intended to avoid. One cannot navigate away, only back to where they were. Whenever we plan to direct a user to a new tab or window, it is advisable to inform them.

<a href="#" target="_blank" title="Opens in new window">link</a>
1 Like

thanks!
got it . I will try them

These are legacy attributes that apply to frameset, a very uncommon thing in today’s era now that we have CSS. Frames predated CSS.

Oof, I was there, Gandalf. I was there 3000 years ago.

1 Like

According to MDN, using target_blank in newer browsers implies the same protection as rel="noopener", so only rel="noreferrer" is neccessary for most browsers now.

Read more about the anchor tag and securtiy on MDN
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#security_and_privacy