12

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?

  • The whole target concept, while still allowed in HTML 5, is generally considered to be outdated. w3.org/community/webed/wiki/HTML_links_-_lets_build_a_web (in the 7 Frames and popups — just say no section) – Jens Mühlenhoff Jan 27 '14 at 18:32
  • 1
    Can 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 May 17 '17 at 22:46
18

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 frame

Much 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:

  • If the target is a user-specified name then it must begin with a letter (no underscores, numbers etc.)
  • If the target is a user-specified name but no frame/window matches that name then create a new tab/window using that name. This is why 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.

  • 7
    You should not refer to W3Schools: w3fools.com – Jens Mühlenhoff Jan 27 '14 at 18:27
  • 1
    I 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 Jan 27 '14 at 23:06
  • 1
    I think that linking to resources known to be problematic is not a good idea. You answer is just fine. – Jens Mühlenhoff Jan 28 '14 at 12:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.