9 ms·
I just had an interesting train of thought. People have assumed for some time now that writing a browser engine from scratch is intractable because of how large
by brundolf 6y ago
I just had an interesting train of thought. People have assumed for some time now that writing a browser engine from scratch is intractable because of how large and complex web standards have become.
But what if you didn't have to implement all of them?
Now, some people would suggest we jettison JavaScript and/or CSS entirely. Or at least all of the additions made to them over the past decade. I think the idea that a browser like this would gain any traction outside of hardcore enthusiast circles is pure delusion.
Instead, what if features were prioritized based on how much of the web uses them? I'd bet that 90% of the web only uses 50% of the web standards out there. Some things like Flexbox are used on practically every new site that gets built these days. But there are dozens of obscure CSS properties that most web developers probably don't even know about, much less use. And JavaScript APIs? There's a host of bespoke progressive-web-app APIs (USB access, anyone?) that hardly anybody uses.
Also, a huge part of the web's baggage is maintaining backwards-compatibility with the entire history of content. This is well and good, but not an ideal that an indie browser could afford to uphold. Frames, image area tags, etc. There's probably a long tail of features - many of them deprecated - that could be jettisoned without having much impact on the average user's experience. Even things like "float", which aren't deprecated, may have been instrumental at one point but are no longer very important.
Prioritizing the standards that matter and de-prioritizing the ones that don't could dramatically cut down on the effort necessary for an MVP.
Taking this further: how do we know which features to prioritize? Most front-end devs probably have a rough idea, but what if we got empirical with it? What if we automatically tested the top 10,000 websites or something and made note of which CSS properties they used, which JavaScript APIs they called out to, and ranked them by frequency (and by popularity of the site?). We could chart a clear, direct path toward "what does it take for a browser to be useful in 2020?"
It's possible this browser could even include existing JavaScript polyfills (https://developer.mozilla.org/en-US/docs/Glossary/Polyfill https://developer.mozilla.org/en-US/docs/Glossary/Polyfill) to help bridge the gap for things that it hasn't yet implemented. Leaning on work that's already been done by the open-source community.
- amelius 6y agoYou still need a fallback solution for cases where the website doesn't work with your version of the standard. Otherwise, users would be very disappointed, and they would switch browsers very quickly. I like the idea, but the migration path needs some serious thinking.
- brundolf 6y agoThe idea is to make a "best effort" solution. Once it's good enough, it could be tolerable for regular users. The next step would be to offer something new, that Chrome doesn't offer, that's compelling enough for the average person to stick with it despite the occasional hiccup. I don't know what that would be. It could be a genuine privacy guarantee (due to the lack of profit-motive), it could be less bloat and therefore longer battery life on their devices. Or it could be a UX-level rethinking of how a web browser is structured. Though for semi-enthusiast users (HN readers), who want things to mostly just work but are willing to put up with some minor discomfort for the sake of idealism, that second part may not be needed.
- svl 6y agoThe complexity in supporting CSS does not come (primarily) from its individual properties, no matter how obscure. It comes from things like margin collapse, from correctly determining the stacking context, and about a gazillion other things like that. These aren't things where you can just scan the CSS of the top websites to find out if they're being used. These are things where you'd have to do visual comparisons to the output of at least two other browser engines to determine if you end up with the same result. Building a browser engine from scratch is imho more doable now than it's ever been before (excepting EME), due to the insane effort by the WHATWG standards to truly describe what is actually happening in browsers (rather than coming up with some theoretically pure description of what is envisioned to happen), and the similar level of detail on the CSS side to the myriad interactions between properties, along with the huge set of testcases for all of that. Yes, there's _a lot_ - but compared to how loosely specified it all was in the past, when the instruction for building a browser engine was: "reverse engineer the bugs the dominant browser engine of today made in reverse engineering the bugs of the dominant browser that came before, and emulate that to your best ability", anyone starting from scratch nowadays has a way better chance at succeeding.
- brundolf 6y ago> These aren't things where you can just scan the CSS of the top websites to find out if they're being used. I guess I was drawing a distinction between a certain subset of functionality that's definitely being used constantly everywhere, like the core box model, vs new features that have gotten layered-on over time and specifically designed not to interfere with or change what came before. For example, the CSS Grid standard has zero effect on any part of page layout unless it is explicitly invoked with "display: grid". These hard barriers were drawn to maintain backwards-compatibility, but they could be leveraged to carve out pieces of functionality to not support, or at least defer support for. > Building a browser engine from scratch is imho more doable now than it's ever been before I agree. And I would actually add Rust as a factor for that. Don't forget, Rust was literally purpose-built for building a web browser. With its focus on memory safety and safe concurrency, I'd bet it will act as a very real force-multiplier when it comes to a project like this. Devs will spend that much less time chasing down race conditions and memory errors, while at the same time getting something highly parallel and performant.
- rumanator 6y ago> But what if you didn't have to implement all of them? In that case the browser would fail to render or even load some websites, which would convey the idea that the browser was a poor piece of software.
- brundolf 6y agoUsually when a feature - especially a CSS feature - is missing, a site degrades gracefully. This varies between features of course, which could be another factor in prioritizing them: how dramatically will the absence of this break something? But if a CSS property is invoked that the browser doesn't know about, it simply ignores it and moves on. The same goes for HTML tags and attributes. This is less true for JavaScript features because accessing a field of an object or attempting to call a function that doesn't exist will throw an exception and cease execution. Though on sites whose JS is mostly peripheral to the content, this can still sometimes result in a mostly-functional site. You could also play a game where you stub out enough of the APIs to prevent exceptions being thrown, without actually fully implementing the features. i.e. make an API function callable, and just not do anything. The idea isn't to write off parts of the web entirely, but to be smart about how things are prioritized and aim for graceful degradation of the overall experience, as a way of dramatically lowering the bar for what it takes to make a browser that could be reasonably used day-to-day.
- frereubu 6y agoInitially I imagine anyone who downloaded this browser would know exactly what they were getting into. I'd download something like this if it was noticeably faster and leaner than other browsers, as long as I could do some kind of quick switch to another, like I do with bangs for Google on Duck Duck Go.
- brundolf 6y agoThe quick-switch idea is interesting. I don't really know how it would work here (embedded Chromium?), but I think the analogy to DuckDuckGo is the right one. DuckDuckGo started as a service for privacy-enthusiasts, and as privacy awareness has become more mainstream we've seen mainstream adoption of it despite its shortcomings compared to Google's results. It a) offered something Google couldn't, and b) became "good enough" on the other axes, and that was enough for regular people to adopt it.
- mponw 6y agoI had a similar thought: Why not build a browser-generator? Some nice presets and checkboxes for options and a single shiny "Build" button. This can't be too difficult, am I right? It would give users the explicit responsibility for broken pieces and also some nice performance gains.
- agumonkey 6y agoI'd pay money to see how would a bunch of mainstream users would react if they only had https://lite.cnn.com/en https://lite.cnn.com/en or https://text.npr.org/ https://text.npr.org/ and similar variant for online services (granted a few pics allowed for shopping) ps: 10$ more on a 'this lowered my medical bills' outcome
- brundolf 6y agoI enjoy the lightweight web too, but I want to stress that that's not what I'm advocating for here. You can't simply expect the population at large (or perhaps more importantly, the corporate community at large) to seismically shift the way they're doing things for the sake of web idealism. You have to meet them where they are. What I'm talking about is finding a pragmatic way to do that.
- agumonkey 6y agoyeah I get it, and I totally agree, radical migrations like that would fail but I'm still willing to bet on how a week of ultralight web would feel to them :)
- eitland 6y agoI've been wondering for a while if we could create an extremely simplified rendering engine that would only accept modern markup and css: - forget everything about quirksmode and all kinds of workarounds that browsers have today. - only accept Javascript from a vetted repository that contains things like autocomplete and ajax reload. - and here comes the smart part: embed it next to an ordinary engine, ideally in Firefox, add a meta tag or content type or something that will get the browser to try to render it in this engine. 1. The idea is to get it to run extremely fast, and 2. get a few websites to optimize for it (Wikipedia?) 3. once people recognize certain pages loads extremely much faster in that browser they'll flock to it 4. more sites will start optimizing 5. since Javascript is extremely limited we get back to a saner content web
- rubber_duck 6y agoA better use case for this engine would be Electron replacement. Much easier to get adoption if you can demonstrate performance benefits and electron apps are more performance sensitive than webpages in general (who really cares about Wikipedia rendering speed - it renders fast enough)
- niutech 6y agoHave a look at https://github.com/cztomsik/graffiti https://github.com/cztomsik/graffiti.
- csande17 6y agoYou may be interested in a project that's doing almost exactly that: a new content type that sits alongside the "classic" web, with a heavy focus on performance and only JavaScript from a vetted repository allowed. https://amp.dev/ https://amp.dev/
- eitland 6y agoIsn't this the thing Google is pushing? If so it has some huge downsides that overshadowes it.
- jancsika 6y agoThis could be coupled with a search engine that indexes the pages which such a browser has been tested to display correctly. So you start off with a small index that includes Richard Stallman's web site and a few thousand others, then add many more as things like flexbox or whatever get added. That feeds in nicely to the development process. The implementation of each new feature has the potential to open up thousands more sites to the index. In fact you could list bounties not in dollars but in the number of new sites a given feature can bring to the index. That way users look at the search engine to first discover the sites that work in the browser. You could go retro like the hand-crafted directory Yahoo used to use, or automate the process. Either way, it's a big improvement in UX. Compare: "While the supported sites do load fast and look great, their search doesn't cover enough sites for my browsing needs." To: "Wouldn't even load Reddit this thing looks hopelessly broken." I bet that it wouldn't take too much effort to get such a project to a place where you get a sizable index with the core feature being the lack of inclusion of sites with dark patterns. Like, an hour spent in this browser is filled with 80% critical reading whereas you'd just be infinitely scrolling through memes 80% of the time in Chrome...
- Taek 6y ago> But what if you didn't have to implement all of them? People will very much tend to prefer using browsers that are fully capable. If your browser only works on 90% of sites, that's not good enough to keep users, it's exhausting to keep switching back and forth. To escape the modern web, you have to offer something that the modern web can't which people are willing to go out of their way to get. Some ideas: privacy, anonymity, no tracking, no DRM, global identity (pubkey based). I don't know if any of these would actually be sufficient to drive a new market, but I think creating a new market is the only way.
- als0 6y ago> global identity (pubkey based) Pubkey based is good, but a global identity is a recipe for disaster. Ideally, you derive a unique identity per domain, while still managing only a single (master) key pair at the user-level.
- kristiandupont 6y agoThe way Firefox initially solved this was with a user-facing version of the Strangler pattern: IE Tab. You could simply tell FF that a given URL needed to be rendered by IE and that would be the case inside your otherwise strictly FF browser. It worked perfectly. That pattern could be reused in such a scenario I guess.
- gvjddbnvdrbv 6y agoThis is briliant. It means bundling Chromium. But it could work.
- Hello71 6y agoIE Tab was an extension, never a native feature. It was one of the many innovations allowed by the open extensions API, allowing anybody to make major features without formal approval.
- jefftk 6y agoThat isn't how it was. When Phoenix was initially released, it was running the Netscape rendering engine with everything else stripped away. There was no IE Tab. Throughout the process of becoming Firebird, and then Firefox, IE Tab was never part of the core browser or default installation. I know: I ran all of these browsers as they came out. Even though many sites were built specifically for IE, it was very rarely bad enough that you couldn't manage with Firefox. Compatibility hadn't gotten that bad. (If you were going to make a dramatically simplified browser today, however, I do think this would be an excellent route to go.)
- trollied 6y agoIt's a shame that the web/browsers have grown up to be so forgiving of shitty markup that isn't valid. The experience would be much better for the user if it was all strict, as I suspect things would be faster.
- ivanche 6y agoCongrats, you just reinvented XHTML :)
- krapp 6y agoMost HTML is generated by frameworks now, isn't it? Is there a lot of non-matching HTML in the wild anymore?
- goto11 6y agoHow would it be better for the user if half the web sites didn't work? I don't think it would have any observable effect on speed. As far as I know, the bottleneck is not parsing the the html syntax, it is rendering.
- hinkley 6y agoMosaic tried to be strict. Netscape was more SGML-like and so it was a slow slide as people said, “well it works in Netscape, so it must be a bug”. The early authoring tools also generated pure garbage for markup. So if you weren’t forgiving, you lost users. Pandering works.
- themacguffinman 6y agoEven if most websites only relies on 50% of the web spec out there, it's likely that many of them rely on a slightly different 50%. That would mean the "common" area needed for a good average experience is significantly larger than 50%. I think this is the trap that non-Chromium MS Edge fell into. I don't doubt that they supported a large subset of websites very well, but the average experience was brought down a lot when it randomly broke or massively slowed down on random websites. The MS Edge case also suggests that it's not enough to just support a standard, it must also be reasonably optimized, because websites can be intolerably slow otherwise. I think many websites, especially web apps, assume that the user's browser is quite fast and can chew through a lot of load.
- kelnos 6y ago> I'd bet that 90% of the web only uses 50% of the web standards out there The problem is the same one faced by people trying to build MS Office competitors back in the 90s and 00s: while that's likely absolutely true, they don't all use the same 50% of those standards/features, so you end up having to implement all of them, or your users will blame you when their favorite random niche website doesn't work, and ditch you for Chrome.
- millstone 6y agoI think there's a great case for a browser which defaults to Reader Mode. Reader Mode is always a better experience when it works. And then build up from there.
- jlokier 6y ago> I'd bet that 90% of the web only uses 50% of the web standards out there. If implementing 100% of web standards is intractably large and complex, then: Implementing 50% of web standards is intractably large and complex too. Unfortunately, you can't turn a humungous problem into a friendly little one by dividing by 2. I would think in terms of dividing by 10 or more. How much of the web only uses 10% of the web standards? My guess is most of it, so we have a chance. > Taking this further: how do we know which features to prioritize? Most front-end devs probably have a rough idea, but what if we got empirical with it? What if we automatically tested the top 10,000 websites or something and made note of which CSS properties they used, which JavaScript APIs they called out to, and ranked them by frequency (and by popularity of the site?). We could chart a clear, direct path toward "what does it take for a browser to be useful in 2020?" This would be great data. Something a bit like caniuse, but showing feature usage rather than browser usage. Getting this data and maintaining it is a full-time job for a team. You can't just fetch the front page of sites to get this info. You need to login and use functionality. Perhaps existing browser telemetry would do a better job, letting users generate the data during normal activity. However you do it, the cost of this idea is mounting up fast :-)
- tekknik 6y agoAnd here, dear reader, you have witnessed the birth of new Internet Explorer. Half the standards of a proper web browser with twice the opinions!