Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

When should you use target="_blank" on your links?

Tags:

html

When are appropriate situations to use the target="_blank" attribute on your hyperlinks?

Edit:

To clarify, I know the syntax will open a new browser window. What I am asking is when is it appropriate to do so?

like image 861
Travis Collins Avatar asked Jun 03 '09 18:06

Travis Collins


People also ask

When should the target _blank attribute be used in a hyperlink?

Anchor links1 may have a target attribute which controls what happens when that link is clicked. One of the possible values of that attribute is _blank , which tells the browser to open a new window (or tab, if that's the user's preference) when that link is clicked.

What is the purpose of setting the target of a link to _blank?

target="_blank" is a special keyword that will open links in a new tab every time. target="blank" will open the first-clicked link in a new tab, but any future links that share target="blank" will open in that same newly-opened tab.

Where do I put _blank?

You can use the target="_blank" attribute if you want your users to click on a link that opens up a new browser tab. The target="_blank" attribute is used inside the opening anchor tag like this.

Is Target _blank deprecated?

It looks like target="_blank" is still alright. It is listed as a browsing context keyword in the latest HTML5 draft.


1 Answers

Whenever you want to annoy users.


More seriously, since this opens a new window/tab, it should be used sparingly, in my opinion.

Most modern browsers have some option (ie: middle-click on hyperlink) to do this for you, so I personally prefer allowing the user to handle this themselves.

However, if you are working on something where there is a non-technical reason for this, such as a sales-oriented site, it's often desirable to open a product brochure in a new window, or something along those lines. However, just be aware that overdoing this leads to my pseudo-joke response above....

like image 193
Reed Copsey Avatar answered Sep 30 '22 15:09

Reed Copsey