Why does target="_blank" have an underscore in front? (2024)
61–70 of 203 posts
Re: Why does target="_blank" have an underscore in front? (2024)
#62So 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)
#63FWIW, I never heard of the frameset tag, while I did use frames back then.
Re: Why does target="_blank" have an underscore in front? (2024)
#64Re: Why does target="_blank" have an underscore in front? (2024)
#65Because making "blank" a reserved word would've been so much harder than making "_blank" one... /s
This all changed in HTML5 when IDs could start with special characters like "_".
Re: Why does target="_blank" have an underscore in front? (2024)
#66So 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.
And a lot of SO answers.
For anyone who writes these, please just leave it blank and revisit it later
Re: Why does target="_blank" have an underscore in front? (2024)
#67Yeah it's a magic value. No shit? Was anyone really confused by this?
Though... yeah it's pretty unsatisfying of an answer generally.
Re: Why does target="_blank" have an underscore in front? (2024)
#68Earlier quoted context omitted.
But why was _name the naming syntax for reserved keywords, specifically?
Probably inspired by C and C++ which reserve names starting with an underscore for the implementation (more precisely, they reserve names starting with `_[_A-Z]` everywhere, and all other names starting with `_` in the global scope only).
Re: Why does target="_blank" have an underscore in front? (2024)
#69Earlier quoted context omitted.
Yeah it’s not a great explanation. To me (and I’m of the era they’re describing so I used it a lot) it’s simply that _blank is a reserved keyword that means open the link in a new, unnamed window. Other reserved keywords for “target” are _self (default value), _parent, and _top. https://www.w3schools.com/TAgs/att_a_target.asp
But why was _name the naming syntax for reserved keywords, specifically?
As with so many things in software engineering, the answer comes down to "some programmer in the 70s working on a UNIX system had to make an arbitrary decision about something, and no one ever had a good reason to change it again."
Re: Why does target="_blank" have an underscore in front? (2024)
#70Earlier quoted context omitted.
And a lot of SO answers.
I was more thinking of javadoc, or other languages where people can automatically generate documentation from the code comments they wrote and 97 out of 100 comments is the function name written as a sentence ("reserveItem(): reserves an item") For anyone who writes these, please just leave it blank and revisit it later