I have been coding for many years and only at this moment I just realized that the property target
from the element <a>
requires all their values start with an underscore (a lot of us know that), but I don't know why? I mean from the top of my head I don't remember another value which required to start with an underscore except for that.
Does anybody know what is the reason behind this implementation, and what other values start with an underscore?
This is just a historical question, but it would be cool to know why everybody uses this convention which I think is only applied to target
.
target - (_blank
, _self
_parent
, _top
)
_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)
a target=”_blank” Open in New Browser Tab (or Window) The target attribute specifies where the linked document will open when the link is clicked. The default is the current window. If target="_blank" , the linked document will open in a new tab or (on older browsers) a new window.
A target attribute with the value of “_blank” opens the linked document in a new window or tab. A target attribute with the value of “_self” opens the linked document in the same frame as it was clicked (this is the default and usually does not need to be specified).
One such case is a website that deals with sensitive customer information. If a health or finance-related website uses _blank for links to private information, it may cause the site visitor to spawn multiple web pages with sensitive information. They may unknowingly leave these windows open unintentionally.
It's not a convention; it's specified in the standard (4.0, 5) that the four reserved names for the target attribute are _blank, _self, _parent, and _top. You can have other target values, but they would be custom names which must start with a letter. Having the reserved ones start with an otherwise illegal value distinguishes them from custom named targets.
target
value can be the name of a frame
.frame
could have the name "blank
".There needs to be a way to disambiguate: Is this the name of a frame or is this the name of a reserved browsing context?
So let’s prefix any reserved name with a specific character and disallow this character for use as first character in other values.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With