2

I decided to stop using _blank and start using _new to avoid slapping users with new windows as much as possible and instead have one single 'new window' and have all the links that open in a new window open in that window that's already opened, that's what _new is for.

I've been looking around the web and Stackoverflow but no one really addresses the value _new in the attribute target= in HTML5.

There's this forum but there's no comment about the _new value: Html Target Attribute not supported.

In W3Schools there's no mention of the _new value in the table they have there: http://www.w3schools.com/html5/tag_a.asp

So my question is: Does anyone know if using target="_new" is valid/correct in HTML5?

Thanks in advance.

Community
  • 1
  • 1
Ricardo Zea
  • 10,053
  • 13
  • 76
  • 79

3 Answers3

3

According to the working draft of the HTML5 specification, the contents of the target attribute must be a "valid browsing context name" (which does not start with an underscore ('_') or one of '_blank, _self, _parent, or _top.'

A valid browsing context name is any string with at least one character that does not start with a U+005F LOW LINE character. (Names starting with an underscore are reserved for special keywords.)

A valid browsing context name or keyword is any string that is either a valid browsing context name or that is an ASCII case-insensitive match for one of: _blank, _self, _parent, or _top.

So, it appears that _new is not supported.

Community
  • 1
  • 1
George Cummins
  • 28,485
  • 8
  • 71
  • 90
  • You're right George. So, what can be used to accomplish the same results of `_new`? – Ricardo Zea Sep 01 '11 at 22:13
  • IMHO, the user should be allowed to decide whether to open a link in a new window or the current one. In many browsers, this is accomplished by holding or not holding the Control key while clicking a link. – George Cummins Sep 01 '11 at 22:16
  • Yes, well, but sometimes the content can't be displayed in the same window since for content architecture reasons the link takes the user to another property/website, so that's why we use a 'new window' icon together with the `title` attribute to let the user know that link will open in a new window. Ok, no probl, I'll see which attribute of the above works. Thanks again. – Ricardo Zea Sep 01 '11 at 22:32
  • You know what, none of them work but I decided to stay with `_new` even if HTML5 doesn't support it, it doesn't make sense to me that I have to open a new window/tab for every single new window link. Talk about 'respect for the user'. – Ricardo Zea Sep 01 '11 at 22:40
2

I think _new never really existed.

The behavior you give to _new actually works with any other valid name: If a window with the chosen name do exists, it is used, instead if it doesn't exists, is created.

"name" clarification:

If you open a new tab/window with an arbitrary target, like target='mywindow', you have "named" that new window (as "mywindow" in this case).

Then, following again a link with the same target, the browser re-uses the same window if still exists, otherwise opens a new one.

Omiod
  • 11,285
  • 11
  • 53
  • 59
  • What do you mean by "window with the chosen name do exists"? Can you elaborate please? Thanks. – Ricardo Zea Sep 01 '11 at 22:41
  • UVL, thanks for the explanation. But, can you use an arbitrary value like "mywindow" then? Aren't we supposed to use only _blank, _top, _self and _parent? In reading W3C's spec seems this is possible, although it's kind of hard to really understand W3C's language: "A valid browsing context name is any string with at least one character that does not start with a U+005F LOW LINE character. (Names starting with an underscore are reserved for special keywords.)". Did I understand this right? – Ricardo Zea Sep 02 '11 at 12:48
  • Yes, _blank, _self, _parent, and _top are special values, each with a different behaviour, while any other valid name is used as I wrote above. The same works with the now obsolete "framesets", where you gave a different name to each frame, then using target to select where links are opened. – Omiod Sep 02 '11 at 13:22
  • Ah! Well, I did not know that you could use arbitrary values for the `target=` attribute. Although George's solution was extremely informative, this is the exact solution to my question above. Thanks for your time UVL. – Ricardo Zea Sep 02 '11 at 15:32
0

To accomplish what you are currently doing, do a global search/replace and change "_new" to a name for the target "frame". See the HTML5 anchor tag reference.

Gregory A Beamer
  • 16,870
  • 3
  • 25
  • 32