So basically It’s an “_blank” because it is.. Author’s description is, “because if it wasn’t _blank.. it wouldn’t open a new tab.” Reminds me of some university professors I had.
Why does target="_blank" have an underscore in front? (2024)
111–120 of 203 posts
Re: Why does target="_blank" have an underscore in front? (2024)
#112I was expecting this post to explain why it's an underscore specifically, as opposed to a dollar sign, an asterisk, a caret, a tilde or some other special character. I can only assume it's a holdover of languages like C where the standard library has some reserved names that start with an underscore. https://devblogs.microsoft.com/oldnewthing/20230109-00/?p=10...
As another borrowed convention, JS developers of yore (and likely some today still) used an _ prefix to denote “private” function/methods. Quotes as it’s just a convention - today JS supports # for actual private members in class syntax.
Re: Why does target="_blank" have an underscore in front? (2024)
#113So basically It’s an “_blank” because it is.. Author’s description is, “because if it wasn’t _blank.. it wouldn’t open a new tab.” Reminds me of some university professors I had.
Re: Why does target="_blank" have an underscore in front? (2024)
#114Re: Why does target="_blank" have an underscore in front? (2024)
#115So basically It’s an “_blank” because it is.. Author’s description is, “because if it wasn’t _blank.. it wouldn’t open a new tab.” Reminds me of some university professors I had.
Not quite. Any name would open a new window unless a frame with that name already exists. This includes the case of the name “blank”. In other words, the first time clicking on a link targeting a name would open a new frame (window) with that name, but the second time would load the content into the existing frame, replacing the previous content. In that scheme, there is no way to open an additional new frame each ti…
> The (reserved) name “_blank” was then defined to have that semantic.
I guess I was hoping for some interesting quirk with older browsers or something.
Re: Why does target="_blank" have an underscore in front? (2024)
#116I was expecting this post to explain why it's an underscore specifically, as opposed to a dollar sign, an asterisk, a caret, a tilde or some other special character. I can only assume it's a holdover of languages like C where the standard library has some reserved names that start with an underscore. https://devblogs.microsoft.com/oldnewthing/20230109-00/?p=10...
Re: Why does target="_blank" have an underscore in front? (2024)
#117Earlier quoted context omitted.
Not quite. Any name would open a new window unless a frame with that name already exists. This includes the case of the name “blank”. In other words, the first time clicking on a link targeting a name would open a new frame (window) with that name, but the second time would load the content into the existing frame, replacing the previous content. In that scheme, there is no way to open an additional new frame each ti…
So again as I understand, it's simply because a standard was decided ? > The (reserved) name “_blank” was then defined to have that semantic. I guess I was hoping for some interesting quirk with older browsers or something.
I now agree that the article doesn’t make a particularly good job in explaining all of this.
Re: Why does target="_blank" have an underscore in front? (2024)
#118[flagged]
Re: Why does target="_blank" have an underscore in front? (2024)
#119Earlier quoted context omitted.
This is exactly what I understood from the article. Your explanation didn't add anything extra.
I actually used the 1.0 version of Netscape Navigator, and did some web development on it back in the day. Originally, _blank, _new, etc. weren’t special. A target ref to a name which wasn’t used would open a new window. If it was already used, it would take you to that open window. People started using _whatever because just ‘blank’ would almost always cause a collision. Eventually it got standardized that it would…