Live data from Hacker News

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

kyrylo.org

91–100 of 203 posts

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

#91

Tangential, but I would really like frames to come back for incremental document updates, like LiveView/Hotwire/HTMX. You can just start working like that today with one of those libraries, but it would be so neat to have a common standard for describing an update to a targeted frame.

Isn't that the use-case for Micro Frontend Architecture? I've always viewed it as a second-coming of Frames. https://micro-frontends.org/

I consider frames to be an example of MFE, actually. I believe I remember reading that Spotify (long ago) used frames in their app so each team could be self-contained.

Edit: In fact, I'm pretty sure Geers' book associated with that site says as much.

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

#92

Tangential, but I would really like frames to come back for incremental document updates, like LiveView/Hotwire/HTMX. You can just start working like that today with one of those libraries, but it would be so neat to have a common standard for describing an update to a targeted frame.

What are you missing by using iframes (still standard, supported, working) + css for layouting that old school frames would give you?

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

#93
post #41

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.

Maybe the article didn’t make it clear enough, but having special targets begin with an underscore has the purpose of avoiding name collisions with normal targets.

The primary thing the article does is explain that there are normal targets in the first place, which is probably the main aspect people might otherwise be missing.

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

#94
post #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

This one sentence is better than the original article.

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

#95
post #9

Earlier quoted context omitted.

[flagged]

Who doesn't?

Seems awfully wasteful. In many (most?) parts of the the middle east you pay for water in a shower and you get 10 minutes. It's usually extremely cheap, but the added realization of water being a limited resources promotes people to be more waterwise.

I wish this was common in the US too but consumption by the American consumer is the most sacrosanct thing in the current world order. As Bush said "The American lifestyle is non-negotiable". Even while the world burns

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

#96
post #37

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

Also worth noting that "_new" is NOT a reserved keyword, but it is sometimes mistakenly used instead of "_blank". Which can lead to funny behavior if you are visiting 2 or more sites making this mistake, as the links could then start opening in windows that were initially opened by the other site. Or least that's how it was back in the days of popup windows, before tabs and popup blockers became the norm.

Not just weird behavior, but possible security issues. Browsers now automatically add a rel="noopener" to links that target _blank to prevent the opened site from gaining full access to your javascript object. Targeting _new does not do this unless you explicity add the rel="noopener" yourself.

https://github.com/whatwg/html/issues/4078 https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes...

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

#97
post #66
post #62

Earlier 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

My experience with this is it is almost always caused by some heavy-handed linter rule, e.g. "fail CI if methods don't have javadoc". Most of those "dumb" linters also almost never catch when a parameter has been renamed but its "@param" was left intact. Drives me crazy.

see also https://en.wikipedia.org/wiki/Goodhart%27s_law

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

#99
post #73

Earlier quoted context omitted.

I nice factoid: in Erlang, `_` if functional. It means "I don't care about this variable". When pattern matching you can put `_` to not bind value in function or pattern to anything or prepend a variable with `_` to tell compiler that you won't be using it, but it's there for "documentation" purposes. For example `[A|_]=List` will extract first element of list into A and ignore rest of list. Underscore has some other…

Yes, many languages use `_` as a placeholder name, and at least in Rust any name starting with `_` is considered intentionally unused.

Aside: many IRC clients would auto-append _ when registering a nick if the desired nick was already registered. Why _? Who knows.

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

#100
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…

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

I used frames to do holy grail lite layout with static header/footer with the main body being the part that continued to update. The footer remaining the same was the only way I could get our early "radio station" to continue playing with the user navigated the site so that the music wasn't interrupted. This was so old, it was using an embedded Real Player. As for ugly, there were no borders from the frameset.

Post reply on HN