14
3
Until today I am wondering why target="_blank"
has not become target="blank"
. I am sure the browsers could understand this as well.
Are there any historcal or technical reasons for this decision / specification?
14
3
Until today I am wondering why target="_blank"
has not become target="blank"
. I am sure the browsers could understand this as well.
Are there any historcal or technical reasons for this decision / specification?
21
If you were to use target="blank"
your link will open in a new tab/window. However, there is a subtle difference. Clicking on the link again will reuse the window that was opened the first time instead of opening a new one.
This is because the target
attribute can be used for more than just opening a new window. It has four built-in values but also allows you to specify your own target. If you look at the relevant W3 Schools page it shows the following options:
_blank
Opens the linked document in a new window or tab_self
Opens the linked document in the same frame as it was clicked (this is default)_parent
Opens the linked document in the parent frame_top
Opens the linked document in the full body of the window<framename>
Opens the linked document in a named frameMuch of this doesn't make sense unless you understand a bit about HTML frames. Using a HTML <frameset>
tag allow you to split the browser window up into individual sections (frames) each with their own page. By giving a frame a name and using the target
attribute in your links it is possible to control which frame should display the relevant content.
But there are some additional rules for the target attribute that browsers must apply:
target="blank"
works the way it does.Basically there is no reason to change the current convention since _blank
is a special case. The original kind of frames may not be used much any more but there are other cases where you can have named objects that the target attribute works with, e.g. iframes which are single frames embedded directly into a page. Changing the standard would break many existing pages without giving any benefit.
1I wished the additional target="_blank"
attribute would not be needed but instead, we could just add a sign to the URL, e. g. an asterisk <a href="*https://www.stackoverflow.com">Stackoverflow</a>
. That would save so much typing :) – Kai Noack – 2019-06-06T06:32:43.217
7
You should not refer to W3Schools: http://www.w3fools.com/
– Jens Mühlenhoff – 2014-01-27T18:27:10.2932I don't disagree that W3Schools isn't the best for web design guidelines, or that using links with the target attribute is outdated. However, I was using the information to specifically answer the original question. – James P – 2014-01-27T23:06:23.170
1I think that linking to resources known to be problematic is not a good idea. You answer is just fine. – Jens Mühlenhoff – 2014-01-28T12:58:37.517
1Can someone explain me why this question was not migrated to StackOverflow to this site? It is a perfect choice for SO and a very weak one for SU -- as per my opinion. – trejder – 2017-05-17T22:46:26.417
The whole
– Jens Mühlenhoff – 2014-01-27T18:32:17.960target
concept, while still allowed in HTML 5, is generally considered to be outdated. http://www.w3.org/community/webed/wiki/HTML_links_-_lets_build_a_web (in the7 Frames and popups — just say no
section)