Live data from Hacker News

Show HN: An interactive guide to how browsers work

howbrowserswork.com

21–30 of 40 posts

Re: Show HN: An interactive guide to how browsers work

#22
post #20

Not all browsers had or have a DOM, and some didn’t until later versions. Early browsers without DOMs (with initial release date): WorldWideWeb (Nexus) (Dec 1990), Erwise (Apr 1992), ViolaWWW (May 1992), Lynx (1992), NCSA Mosaic 1.0 (Apr 1993), Netscape 1.0 (Dec 1994), and IE 1.0 (Aug 1995). Note: Lynx remains a non-DOM browser by design. AOL 1.0–2.0 (1994–1995) used the AOLPress engine which was static with no progr…

Thank you for the suggestion! Would be writing something like "DOM in the modern browsers" more correct then?

> Would be writing something like "DOM in the modern browsers" more correct then?

No, I don't think so. I don't know why the GP comment is at the top beyond historical interest. If you continue with your plans mentioned elsewhere to cover things like layout, rendering, scripting, etc, under this standard almost everything will have to have the "in modern browsers" added to it.

Part of the problem is the term "DOM" is overloaded. Fundamentally it's an API, so in that sense it only has meaning for a browser to "have a DOM" if it supports scripting that can use that API. And, in fact, all browsers that ever shipped with scripting have had some form of a DOM API (going back to the retroactively named DOM Level 0). That makes sense, because what's the point of scripting if it can't interact with page contents in some way?

So, "Lynx remains a non-DOM browser by design" is true, but only in the sense that it's not scripted at all, so of course it doesn't have DOM APIs, the same way it remains a non-canvas browser and a non-webworker browser. There's no javascript to use those things (it's a non-cssanimation browser too).

There's a looser sense of the "DOM", though, that refers to how HTML parsers turn an HTML text document into the tree structure that will then be interpreted for layout, rendering, etc.

The HTML spec[1] uses this language ("User agents must use the parsing rules described in this section to generate the DOM trees from text/html resources"), but notes it's for parsing specification convenience to act as if you'll end up with a DOM tree at the end of parsing, even if you don't actually use it as a DOM tree ("Implementations that do not support scripting do not have to actually create a DOM Document object, but the DOM tree in such cases is still used as the model for the rest of the specification.")

In that broader sense, all browsers, even non-modern ones (and Lynx) "have a DOM", since they're all parsing a text resource and turning it into some data structure that will be used for layout and rendering, even if it's the very simple layouts of the first browsers, or the subset of layout that browsers like Lynx support.

[1] https://html.spec.whatwg.org/multipage/parsing.html

Re: Show HN: An interactive guide to how browsers work

#24
post #21

Claims that browsers transform "d.csdfdsaf" -> https://d.csdfdsaf , but they don't. They only transform domains with valid TLDs, unless you manually add the URL scheme.

It is a good one to fix. Thank you!

The "guesswork" done by browsers is actually pretty nuanced and not standardised in a slightest way. Some defaults are pretty common, and could be maybe considered de-facto standard, but I wouldn't want to draw the line where "most" browsers agree or should agree.

Personally, I have my browser set up to "guess" as little as possible, never do the search from the URL bar unless explicitly told to do so using a dedicated search keyword (plus I still keep separated auto-collapsing search bar). I have disabled all guessing for TLDs, auto prepending www. In short, when I enter "whatever" into my URL bar, my browser tries to load to "http://whatever/", what could be my local domain and I could get an answer -- it is is a valid URL after all. In a related note, I strongly doubt that any browser does the web search for "localhost".

The rabbit hole could naturally go even deeper: for example most browser still interpret top-level dataURIs. It is not that long browsers interpreted top-level `javascript:` URIs entered into URL bar, now surviving in bookmarklets but taken from all users for the sake of a pitiful "self-XSS prevention".

So I would be really careful telling what happens -- or, god forbid, should happen -- when someone types something into their URL bar: "whatever" could be a search keyword with set meaning: - it could be bound to http URL (bookmark), - the bookmark URL could have a `%s` or `%S` and then it would do the substitution, - it could be a `javascript:…` bookmark ("bookmarklet"/"favelet"; yes, most browser still let you do that, yet alas, mostly fail to treat CSP in a way it would remain operational). - It could be a local domain.

The fact that, statistically, "most" browsers will do a web search using some default engine is probably correct but oversimplifying claim that glosses over quite a lot of interesting possibilities.

Re: Show HN: An interactive guide to how browsers work

#25

Claims that browsers transform "d.csdfdsaf" -> https://d.csdfdsaf , but they don't. They only transform domains with valid TLDs, unless you manually add the URL scheme.

Who or what gets to say what a valid TLD is? Especially when people take advantage of their own local resolvers, they could create anything at any time.

Re: Show HN: An interactive guide to how browsers work

#26

Not all browsers had or have a DOM, and some didn’t until later versions. Early browsers without DOMs (with initial release date): WorldWideWeb (Nexus) (Dec 1990), Erwise (Apr 1992), ViolaWWW (May 1992), Lynx (1992), NCSA Mosaic 1.0 (Apr 1993), Netscape 1.0 (Dec 1994), and IE 1.0 (Aug 1995). Note: Lynx remains a non-DOM browser by design. AOL 1.0–2.0 (1994–1995) used the AOLPress engine which was static with no progr…

The last time I checked, Dillo also has no DOM in any reasonable definition of the term; instead it directly interprets the textual HTML when rendering, which explains why it uses an extremely small amount of RAM.

Re: Show HN: An interactive guide to how browsers work

#27

Claims that browsers transform "d.csdfdsaf" -> https://d.csdfdsaf , but they don't. They only transform domains with valid TLDs, unless you manually add the URL scheme.

Who or what gets to say what a valid TLD is? Especially when people take advantage of their own local resolvers, they could create anything at any time.

IANA maintains a list of TLDs in the root zone[0]. I presume browsers use this list, since it does cover all TLDs in >99% of situations.

[0]: https://data.iana.org/TLD/tlds-alpha-by-domain.txt

Re: Show HN: An interactive guide to how browsers work

#28
Perhaps worth editing the DNS section in light of RFC 9460 ... depending on the presence and contents of the HTTPS RR, a browser might not even use TCP. Here's a good blog post surveying the contents of the HTTPS RR a few years ago. https://www.netmeister.org/blog/https-rrs.html

Re: Show HN: An interactive guide to how browsers work

#29

This is pretty relelevant to a project I'm working on - a new web browser not based on Chromium or Firefox. Web browsers are extremely complex, requiring millions of lines of code in order to deal with a huge variety of Internet standards (and not just the basic ones such as HTML, JavaScript and CSS). A while ago I wanted to see how much of this AI could get done autonomously (or with a human in the loop), you can se…

[deleted]

Re: Show HN: An interactive guide to how browsers work

#30

Earlier quoted context omitted.

Who or what gets to say what a valid TLD is? Especially when people take advantage of their own local resolvers, they could create anything at any time.

IANA maintains a list of TLDs in the root zone[0]. I presume browsers use this list, since it does cover all TLDs in >99% of situations. [0]: https://data.iana.org/TLD/tlds-alpha-by-domain.txt

Yes but local/corporate DNS servers can use any TLD they want...
Post reply on HN