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 wi开发者_高级运维ndow' 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.
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.
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.
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.
精彩评论