278 points · by OuterVale · 1y ago · 190 comments
- 1995 Sept https://web.archive.org/web/19990202141025/http://home.mcom.... Netscape Navigator 2.0a2 release notes including rollout of TARGET.
- 1995 Sept https://lists.w3.org/Archives/Public/www-html/1995Sep/0034.h... First definition of them; spec text provided by "the Netscape Navigator marketing guy".
- 1997 Jan https://www.w3.org/TR/2018/SPSD-html32-20180315/ HTML 3.2 published without frame target names specced.
- 1997 Aug https://lists.w3.org/Archives/Public/www-html/1997Aug/0010.h... Roles of these target names clarified
- 1997 Dec https://www.w3.org/TR/html401/types.html#h-6.16 HTML 4.0 published with target names.
I can't find any discussion about the choice of character. My guess is that discussion was internal to Netscape as they shipped _then_ specced link target names.
I'm not saying this is the answer, but it very well could be that whoever wrote the function that handles this decided on an underscore and nobody ever even questioned it.
I've used it everywhere ever since when most people would just use _blank. If you're like me and ever go down and article, clicking all of the links to open in new tabs to look at later then you're welcome...I saved you a few wasted tabs when you clicked on the same link more than once.
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...
But doesn't it all trace back to C conventions anyways?
1. https://developers.google.com/apps-script/guides/html/commun...
So a variable that really ought to be named `class` you name `class_`.
A related conventional use of underscores in JS variable names is when "discarding" values in positional settings, like destructuring arrays.
E.g. `const [_, a, b] = triple`
In general, underscores in JS seem to be used to help call out what to ignore or what is less important.
I'm willing to bet there are kids who do not though. Given how many crazy colours my IDE shows everything in, I could definitely believe there are people that go, 'Why bother, aren't those private members blue anyway?', or some such similar train of thought.
Of course if your IDE is little more than notepad, then such things are still important. For me, that's the Arduino IDE. I have to admit I really like writing micro controller code in it, it's a bit like writing code 30 years ago (both the good and bad parts).
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.
The _ comes from the W3C in 1995 well before JavaScript was commonly used for templating HTML.
Scripting has used $ for variables for a long time: I think the most relevant history line for $variable is PHP comes from Perl comes from shell scripts. I also remember finding $ ugly on Vax.
There were a huge variety of templating syntaxes for server side and HTML generation was virtually all server side in the 1900s.
Server side languages were very rarely JavaScript before Node in 2009.
JavaScript wasn't used much for HTML generation before Ajax. There were soon after many many client side templating syntaxes.
I'm guessing only Brendan Eich could say why $ was accepted for JavaScript variable names.
Timelines are hard because the foundations were compressed within a decade: JavaScript 1995, PHP 1996, DHTML 1997, Ajax early 2000s, jQuery 2006.
Syntaxes tend to be extremely path dependent, and every developer cribs from everything they use.
cat <<!
<div>
...
<a href="$url" target="_blank" ...
...
!
A form of CGI existed as far back as 1993 on the NCSA web server.Because you could "NameAFrameAnyThingYouWanTED" they made some magic targets, _blank window to open a blank window (we have tabs, then we did not), _self to open in the same frame or window, _parent to open in the parent frame, _top to break out of frames entirely (this is how you would bypass the ad some free .coms would inject into your site)
When I read the html spec in the 90s all it says was you can name a frame anything except don't use _ as _ is reserved for special frame types.
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 always open a new blank window.
In anglefire and maybe geocities we would serve the document with a .txt extension and it would also skip the ads but browsers, with their liberal acceptance policy, would render normally.
> 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.
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.
For anyone who writes these, please just leave it blank and revisit it later
I got into web dev after HTML5, I've never heard of <frameset>
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://github.com/whatwg/html/issues/4078 https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes...
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."
I'd be interested to hear either a citation proving or disproving that guess though.
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.
But no.
Fret no more:
<style>
.blink { animation: blink 1s steps(2, start) infinite; }
@keyframes blink { 50% { visibility: hidden; } }
</style>
<p class="blink">Lorem ipsum</p>
https://jsfiddle.net/xrkLt2nz/Edit: In fact, I'm pretty sure Geers' book associated with that site says as much.
iframes are also in a rather locked-down security model, even if they exist on the same domain. (Requires message passing, strict CORS rules, strict cookies rules etc)
It all honestly seemed a lot easier than what has come after.
(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.
Table-based layout was already falling out of favour before this happened. Even when you had fixed sites that were predominantly desktop, divs and spans (coupled with CSS) made life a lot easier to put things where you wanted them and lay out a site faster. It was also cleaner when reading the markup.
From what I remember, the move away from tables happened around the same time external CSS took off and you could partition your site with reusable styling instead of framesets or tables.
Responsive design then sped up the process a few years later.
It's funny looking back at this SO question from 2009, and its answers: https://stackoverflow.com/questions/426253/why-use-tables-to...
There was definitely an ongoing culture war between people who felt like using tables was not "proper", and people who just wanted their site layout to work consistently in IE6.
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.
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.
Ironically people moved to divs and spans, which when combined with the old box model issues, made the problem even worse.
The semantic web elements in HTML5 was an attempt to fix those issues.
The reason we moved away from it was that after a point, the amount of legwork to implement relatively simple behaviours became astronomical. Whether or not the current state of matters is "better", who's to say. But things are certainly much easier now.
Besides, you still can use those old modes if you want to :)
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 level in the frame hierarchy) and "_top" to replace the whole page.
Second, at the time it was clearly not "open the link in a new tab" but rather in a "new window". IE was the most used browser back then, by a large proportion, and it didn't supports tabs at all.
Internet Explorer barely even existed back then, it certainly wasn’t the most used browser. That came later. No browser had tabs back in those days.
Technically, the underscore was restricted and should not be used for user defined targets/frame names. This isn't something any browser I know of ever enforced.
On Firefox I have the "Send Link to Device" context action that allow me to open a link on my Phone or Desktop.
A website designer then might say "share this url on click" and the browser takes over and/or defers to the OS.
Now, the share() [https://developer.mozilla.org/en-US/docs/Web/API/Navigator/s...] falls short in passing along context for login (e.g. cookies) so I'd imagine that this would either be part of the browser, or something the share() api could extend on, though I'd be unconfortable about the security implications of the latter.
The share() also falls short on desktop in my experience. AFAIK, firefox (on linux?) doesn't even have the share() API available.
The browser now already registers itself as a target to share web urls. It does this already (on my mobile devices at least) as "Open URL in Firefox" for example.
It should and could also add a target to share web urls, but call it "Send to device". Firefox for Android used to have this and it was awesome. But mozilla somehow dropped it. (There was a long thread on a bug report about exactly this, but I cannot find it).
Also, when I choose that option, it'd not just send the url along, but could also send any cookies or even localstorage and other data along. That way I'd be logged in.
That last part would be part of the "send to " feature, in Firefox called "firefox sync" and possibly be configurable from there to opt out of sending session or other data along.
Point is: there's no need for extra "target=" hackery, we already have all the tech in place to send links to devices. Instead, we'd have to convince browser builders to improve this tech and the UX of it.
We use QR codes to transfer the user - a solution would need to be as simple as that (Ie. not requiring the user to be logged in on the same browser or other shenanigans).
The current solution is a hasle, but works well - I can't envision how a target="_mobile" should solve this? Especially since you need to transfer authentication also.
https://www.collinsdictionary.com/dictionary/english/shower-...
https://www.collinsdictionary.com/dictionary/english/tongue-...
(Not mocking, I just really liked the explanation and it happened to be the same site)
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
<a target-new-window=true target-top-frame=true target-self=true ...
Now the browser needs to define and document some kind of priority to solve those situations.
If you can have only one target anyway why not simply give special targets special values.> Hi. I'm the Netscape Navigator marketing guy. Please forgive the temerity with which we submit this new proposal from Netscape to the W3 and IETF for enhancements to HTML 3.0. It pertains to functionality called Frames.
...
> The NAME attribute is used to assign a name to a frame so it can be targeted by links in other documents (These are usually from other frames in the same document.) The NAME attribute is optional; by default all windows are unnamed.
> Names must begin with an alphanumeric character. However, several reserved names have been defined, which start with an underscore. These are currently: _blank Always load this link into a new, unnamed window. _self Always load this link over yourself. _parent Always load this link over your parent. (becomes self if you have no parent). _top Always load this link at the top level. (becomes self if you are at the top).
_blank is evil and user hostile. Don't be evil and user hostile.
[0] https://economictimes.indiatimes.com/tech/internet/world-wid...
Framesets are obviously out of date, but the target attribute can also be used to always open some links in the same tab with that target name, i.e. not to open a new one when it already exists. Not sure whether this has much of a modern use case.
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.
They were. The most fundamental part of the WWW architecture is the URL. URLs are more important than even HTML or HTTP. Without addressability, the web doesn’t work.
Frames break URLs because you can visit a site that uses frames, navigate around the site, and the URL won’t change. You can’t link to the place you arrive at. Frames break addressability and this makes them go completely against the grain of the WWW. Flash and Java applets were fundamentally at odds with the WWW architecture as well for the same reason.
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.
Isn't iframe the replacement? iframe is not deprecated.
Always thought it was a creatively simple solution, but had no idea the pattern had existed (and was used) for so long.
You still see _blank for links opening in new windows, but _parent, _self, etc not so much anymore.
Tell that to the enterprise email scanning software my Fortune 500 company uses
Enjoy! (check the source)
Are you still using the original Claris Home Page software to maintain the website?
He also has a bunch of wordpress websites. He's scared to change his "main" website because it might break SEO or bookmarks or incoming links.
He has 2 laptops on his desks; one modern M-based macbook and that ancient powerbook. He also has a black apple laptop that I think is a G3, and it still worked (a few years ago, last time it came up)
Though... yeah it's pretty unsatisfying of an answer generally.
This all changed in HTML5 when IDs could start with special characters like "_".
This is the actual answer and TFA somehow missed it completely.