Live data from Hacker News

Why does target="_blank" have an underscore in front? (2024)

kyrylo.org

51–60 of 203 posts

Re: Why does target="_blank" have an underscore in front? (2024)

#51
post #44

> developers needed a way to explicitly tell the browser to open the link in a new tab, free of frame semantics First, it doesn't say why an underscore does that, because you could totally have underscores in frame names. My guess as others here is that the underscore prefix dates back from reserved names in C and C++. IIRC the reserved names also included "_self" (even if it was the default), "_parent" (to go up a l…

Probably the most likely explanation, given so many things do inherit idiosyncrasies from C. I'd always assumed it was from Perl, given its heavy use in CGI back then -- like $_ being the default var. But that would probably also eventually inherit from C :P

Re: Why does target="_blank" have an underscore in front? (2024)

#52
post #23

Earlier quoted context omitted.

Author here — thank you! You're absolutely right, and I've corrected it!

Another nitpick: the attribute was called name, not id. https://www.w3.org/TR/html401/present/frames.html#h-16.3

Thanks, fixed!

Re: Why does target="_blank" have an underscore in front? (2024)

#53

I think it's funny that Mozilla says not to use frames anymore, they work just fine on modern browsers...

You mean [the mdn docs]( https://developer.mozilla.org/en-US/docs/Web/HTML/Element/fr... )? Looks like classic deprecation to me: they'll still 'work', you just shouldn't use them. In the same way that tables-for-layout still 'works', but you shouldn't actually do that.

Actually, frames were ugly, limited and not really ergonomic but they weren’t a wrong pattern.

They solved a real problem of having parts of the page that changes and other parts that didn’t. It’s a shame they were deprecated without a modern replacement.

An "include" mechanism (like what html provides) should have been proposed to replace this use case.

The deprecation of frames forced dynamic websites (wether it is client or server side) on everyone and i feel like it is in part responsible of why people stopped to handcraft websites.

Re: Why does target="_blank" have an underscore in front? (2024)

#55
post #7

FWIW, I never heard of the frameset tag, while I did use frames back then.

Olia Lialinas "My boyfriend came back from the war" is a classic piece of netart that uses frameset in a unique way. It's still online:

http://www.teleportacia.org/war/war2.htm

Re: Why does target="_blank" have an underscore in front? (2024)

#57
post #53

Earlier quoted context omitted.

You mean [the mdn docs]( https://developer.mozilla.org/en-US/docs/Web/HTML/Element/fr... )? Looks like classic deprecation to me: they'll still 'work', you just shouldn't use them. In the same way that tables-for-layout still 'works', but you shouldn't actually do that.

Actually, frames were ugly, limited and not really ergonomic but they weren’t a wrong pattern. They solved a real problem of having parts of the page that changes and other parts that didn’t. It’s a shame they were deprecated without a modern replacement. An "include" mechanism (like what html provides) should have been proposed to replace this use case. The deprecation of frames forced dynamic websites (wether it is…

>> It’s a shame they were deprecated without a modern replacement.

Isn't iframe the replacement? iframe is not deprecated.

Re: Why does target="_blank" have an underscore in front? (2024)

#58

The answer is a little unsatisfying to me. It says that "blank" ca be a frame name, but doesn't say why "_blank" can't be.

In other answer they link to the original specification [1], and it says that names must start with a letter, so anything preceded by "_" cannot be a frame name.

[1] https://www.w3.org/TR/WD-frames-970331#frame

Re: Why does target="_blank" have an underscore in front? (2024)

#59

Shower thought: ` ` should transfer a link in a desktop into my phone. Same goes for `target="_desktop"` but in the opposite direction.

Yay, that would be awesome for cross-device tracking! Also don't forget about _tablet, _phablet, _tv, _laptop, _watch, _work_laptop, _smart_speaker, _ereader, etc.

Re: Why does target="_blank" have an underscore in front? (2024)

#60
post #36

Earlier 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?

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).
Post reply on HN