Difference between _blank / _self and blank / self

8

I would like to know if there is any recommendation on using the target Html attributes with or without _ before the value, I see that it's kind of standard to use it with _ , but if it is missing the redirection also works:

<a href="https://www.google.com" target="_blank">Blank com _</a>
<a href="https://www.google.com" target="blank">Blank sem _</a>
<a href="https://www.google.com" target="_self">Self com _</a>
<a href="https://www.google.com" target="self">Self sem _</a>
    
asked by anonymous 13.12.2018 / 19:12

2 answers

9

The undescore ( _ ) prefixed in _blank or _self has the function of indicating where the link will open. The first in a new tab, the second in the tab itself.

_blank indicates that the link will always be opened in a new tab, no matter how many times it is clicked: if you click 100 times, 100 new tabs will be opened.

If you omit _ , using only blank , the target loses the specific function and becomes just a common target, meaning that you are opening a new tab named "blank". So whenever you click the link, the browser will check if it already has an open tab with that name. If it does, it loads the link in the already open tab, if not, it opens a new one. The same goes for pro target="self" , or target="qualquercoisa" etc.

    
13.12.2018 / 19:30
4

About% under ) see that according to this W3C documentation it must precede reserved special keywords. Without it the string is like a normal string and is interpreted differently by the browser link

  

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

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

U + 005F Unicode Character 'LOW LINE' _

However, in the W3C HTML validator itself, the code passed without any problems

Test link

Another curiosity is that this attribute is underscore link

    
13.12.2018 / 19:31