Live data from Hacker News

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

kyrylo.org

141–150 of 203 posts

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

#141

Why did we move away from this model of web development? If I remember back that far, it seems like fairly soon after this was when the meta starting telling us that frames were bad, and using was bad, etc. It all honestly seemed a lot easier than what has come after.

I have to use, still, a set of documentation that is formatted using an old-style two-frame layout—contents/search on the left, article on the right. It sucks, because unless I’m willing to lose the left frame, I can’t open articles in new tabs, I can’t bookmark them, I can’t copy their addresses. The back button kind of works, but the menu items are useless (they all contain the title of the frameset). And so on.

The layouts people were trying to create with frames weren’t bad, but browser behaviour around framesets isn’t good. I didn’t really have a good enough Internet connection at the time, but looking at them now I do agree that frames break linking too hard and shouldn’t be used.

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

#142

Why did we move away from this model of web development? If I remember back that far, it seems like fairly soon after this was when the meta starting telling us that frames were bad, and using was bad, etc. It all honestly seemed a lot easier than what has come after.

The direct answer to your question is that the idea of "responsive" web design gradually took over when smartphones became popular. People liked the idea of not needing to create a separate mobile version of their frontend, and instead simply adjusting the styling and structure of the page in response to the size of the viewport. Tables were bad at this because you couldn't use CSS to arbitrarily move around the way a table is structured.

(The funny thing is that, in modern browsers this is no longer true - you actually can use CSS to restructure table layouts now. But, the world has already moved on.)

Though there's a broader answer, which is that generally as web design has modernized, so too have ideas of "semantic" markup. Semantically, table is supposed to be used to display data. HTML which is used for its proper semantic purpose is easier for screen readers, improving accessibility, and easier for search crawlers to make sense of the content, improving SEO. So a lot of old HTML tricks fell out of use when HTML5 started becoming popular.

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

#143

Why did we move away from this model of web development? If I remember back that far, it seems like fairly soon after this was when the meta starting telling us that frames were bad, and using was bad, etc. It all honestly seemed a lot easier than what has come after.

We moved away from it because frames are quite limited in what UI's they can express. I don't know that it's true that what we have now is much more complicated, because it's pretty simple to build a multi-pane layout with CSS grid or flexbox.

I think frames are an artifact of the time when people thought of HTML as a desktop publishing markup language. It has evolved into a generalized UI description language.

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

#144
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.

It is what it is because it's that. You can tell, you just have to look at how it is. If it's like that, then it is what it is. If it isn't what it is it would be something that it isn't but still be what it is. Luckily for us it's what it is, not what it isn't.

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

#145
post #90

Earlier quoted context omitted.

The tag needs to make a comeback; I'm so tired of having to write my own JavaScript to get annoying flashy text. In all seriousness, I'm not entirely sure why so many features in HTML are eschewed in favor of a slow JS mess. It doesn't feel like bolting on an entire relatively-slow programming language is going to make your code more organized than a relatively easy to use tag.

> I'm so tired of having to write my own JavaScript to get annoying flashy text Fret no more: .blink { animation: blink 1s steps(2, start) infinite; } @keyframes blink { 50% { visibility: hidden; } } Lorem ipsum https://jsfiddle.net/xrkLt2nz/

If front-end devs would stop reinventing things using JS that can be done in CSS, I'd be so happy.

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

#146
post #105

Earlier quoted context omitted.

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.

This is a direct descendant of ActionScript. It introduced the convention of Instance._getter and Instance.__private.

That looks like ActionScript 2, so the javascript convention was actually well in place by then. I can't speak confidently about the late 90s, but I wouldn't be surprised if it predated Actionscript 1 as well.

But doesn't it all trace back to C conventions anyways?

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

#147
post #58

Earlier quoted context omitted.

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.

That sentence wouldn't have made sense to me before I read the original article.

I got into web dev after HTML5, I've never heard of

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

#148
post #54

Wait, so frameset is basically htmx?

I've been doing web development on and off for 30 years and in no other programming field have I seen this perpetual habit of rediscovering the wheel.

Hey, we may be spinning in circles, but at least the websites consistently get slower over the years

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

#149
post #18

I 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...

Making it a dollar sign would cause countless bugs for people who generate HTML using templating languages whose variables are indicated by dollar sign. From time to time, someone would add target="$blank" to a templates, forgetting that the $ must be escaped to be literal.

They might have to resort to predefining a reserved variable called blank, whose value is "$blank". :)

Similar reasoning applies to most other special characters.

Given how HTML gets generated by preprocessors which use special characters in this manner or that, its best not to come up with new schemes within HTML itself involving special characters.

Carving out a reserved space within an existing namespace is safe.

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

#150
post #88
post #18

I 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...

I wouldn’t say it’s a “holdover”, it continues to be a common convention for marking internal or reserved use.

Some modern languages even turn _ flagged variables/parameters into black holes
Post reply on HN