News for hackers. Stuff that matters.
Re:Browsers are pretty good at loading pages by TeMPOraL on Sunday July 21, 2019 @05:26PM (#20493770)
> Because it's faster.

The whole point of the article is that it's not true. It's not the only article that disproves it, and honestly, it's not difficult to notice it. Just go to any blog running off a static site generator; loading times of pure HTML webpages on good connection are so fast they whole thing outruns client-side page switches even if the page is already in memory.

Re:Browsers are pretty good at loading pages by sangnoir on Sunday July 21, 2019 @07:05PM (#20494251)
> The whole point of the article is that it's not true.

Only for the narrow condition of loading a whole page. A lot of Web apps make async request much smaller than loading the whole page: imagine deleting one record in a list of 50 items; the async response could be the HTTP 200 header alone.

I think it would be useful for developers to separate web applications from web sites and consciously make trade-offs (such as state management: for the projects I have worked on, adding "Undo" logic was far simpler with client-side state-management. YMMV)

Re:Browsers are pretty good at loading pages by delinka on Sunday July 21, 2019 @07:46PM (#20494429)
Web apps making async requests should be making much smaller requests than loading the whole page - but they're not. They're loading a page and parsing out the "less than the page" bit to stick into the current page; or they're loading a JSON blob bigger than the current page to update the three visible elements on the page.

Imagine Software Engineers that actually engineered solutions - the use of small async requests would be a boon to everyone! But no one's doing this.

I know first hand of one company doing this nonsense with requesting a full JSON payload (describing the whole house that goes along with the proverbial kitchen sink), rather than requesting updates for the one property on the user's screen. I've proxy-sniffed at least two other, unrelated companies doing exactly the same thing.

Re:Browsers are pretty good at loading pages by sangnoir on Sunday July 21, 2019 @08:12PM (#20494540)
> They're loading a page and parsing out the "less than the page" bit to stick into the current page; or they're loading a JSON blob bigger than the current page to update the three visible elements on the page.

This is...disgusting. I was speaking of applications I have personally worked on; the teams/organizations I have worked with were concerned about performance (and measured it with regression testing). I suspect the oversized responses and cherry-picking are a result of back end and client being responsibilities of independent teams and client team is told "use this pre-existing kitchen-sink endpoint".

Re:Browsers are pretty good at loading pages by swiley on Sunday July 21, 2019 @09:19PM (#20494760)
It’s certainly possible to write good client side code, I’ve worked on teams that really care and are given room to do it (because they were able to demonstrate its worth after so much effort.) and on teams that don’t.

JavaScript, as she is spoke, is just an awful language. It has brilliant ideas and if applied correctly could make everyone’s lives better but that’s just not how it’s used.

Re:Browsers are pretty good at loading pages by bryanrasmussen on Monday July 22, 2019 @12:32AM (#20495345)
So your argument is that many teams don't care and do a bad job and it is the fault, somehow, of the language they use?
Re:Browsers are pretty good at loading pages by TeMPOraL on Monday July 22, 2019 @03:16AM (#20495901)
It's a powerful argument. Defending client-side rendering here (or SPAs) is almost no-true-Scotsmanish. It is technically possible to do a good job, but it's almost never done. Yours and sangnoir's teams may care about performance and do actual software engineering - but it doesn't help me much when my bank doesn't do it, the places I shop don't do this, big sites like Reddit don't do this, and seemingly none of the SPAs I've visited in the past 5 years do it.
Re:Browsers are pretty good at loading pages by sangnoir on Monday July 22, 2019 @11:25AM (#20498882)
Have you used the banks mobile applications, and are they fast? I suspect you're right to say there's a cultural issue, but it's not with the language, but with the organization building on the platform. If they don't care about the user experience on the web, they wouldn't care about it on a native desktop or mobile application either.
Re:Browsers are pretty good at loading pages by marcus_holmes on Monday July 22, 2019 @04:14AM (#20496149)
Yeah, but how is this the fault of the language?

There's nothing inherent in JS to say "you must do a shitty job of optimising your page speed"

I'm working on replacing a PHP app that is currently taking 20 minutes to refresh the index page because their SQL doesn't scale. Is that the fault of PHP, SQL, or the developers who wrote it?

You can write crap code in any language (even Rust!).

Re:Browsers are pretty good at loading pages by TeMPOraL on Monday July 22, 2019 @05:31AM (#20496465)
It's probably not the fault of the language per se, just the culture surrounding the use of that language.

It could be argued that the same language, given another chance, would produce a similar culture, though I'm not 100% convinced of that. Anyways, what we need is a reboot of web development culture.

Re:Browsers are pretty good at loading pages by bryanrasmussen on Monday July 22, 2019 @06:51AM (#20496812)
Maybe it's a fault of Sturgeon's law - I sort of wonder if the "necessity" to have so much web output - so many applications, so much new development does not create a situation where there is a pressure to make 95% of everything crap, because you need to get a lot of developers to make things and some of those developers are going to be crap, and you need to make lots of decisions and some of those decisions are going to be crap, and you need to do a lot of changes in short periods of time and that results in a lot of crap.

It just seems more likely to me than any culture about a language per se.

Re:Browsers are pretty good at loading pages by TeMPOraL on Monday July 22, 2019 @07:23AM (#20496941)
Might be, but I wouldn't discounting culture as a mechanism reinforcing it. People aren't working in isolation; they build on each other, and enshrine "best practices" that are often enough the sources of these problems.

But thinking of it, Sturgeon's law may be at play. PHP used to suffer from similar reputation to JavaScript, and only started regaining its status as a proper server choice once the masses moved to greener pastures. Sure, the language was a "fractal of bad design" and had footguns galore, but it wasn't that bad, and most of the traps were avoidable when you had half a brain and used it. The web may be crap very well because it's where anyone fresh to programming can find a high-paying job, and you can become a "senior engineer" after one year of job experience.

But that, still, is a problem. Outside of programming, there are quality standards on the market - often enforced by governments. Even if 90% of chairs are crap, you can't go and sell that crap to the public. Quality standards filter most of the crap out.

If that's the case, I'm not sure what to do. Introducing quality regulations to programming might help solve the problem of website bloat and constant leaks of private data, but it would also destroy the best thing about the web and programming in general - if you have an idea and a computer, you can make it and show it off to everyone.

Re:Browsers are pretty good at loading pages by repolfx on Monday July 22, 2019 @02:05PM (#20500561)
PHP is considered a proper server choice these days? When did that happen? It's been a long time since I encountered a new project being written in PHP.
Re:Browsers are pretty good at loading pages by bryanrasmussen on Monday July 22, 2019 @03:10PM (#20501261)
I don't do php but I assume any resurgence would have something to do with Laravel.
Re:Browsers are pretty good at loading pages by nmjenkins on Sunday July 21, 2019 @10:27PM (#20494987)
> the use of small async requests would be a boon to everyone! But no one's doing this.

Some of us are! RFC8620 is purpose-designed for building network efficient APIs: https://tools.ietf.org/html/rfc8620

Re:Browsers are pretty good at loading pages by delinka on Sunday July 21, 2019 @10:48PM (#20495042)
I apologize for the hyperbolic “no one.” I was rushing...
Re:Browsers are pretty good at loading pages by namibj on Sunday July 21, 2019 @07:54PM (#20494458)
GraphQL was made to fix that issue.
Re:Browsers are pretty good at loading pages by strken on Monday July 22, 2019 @05:25AM (#20496437)
GraphQL's nice if you want a third option to the choice between many bespoke endpoints or few generic endpoints, but if your problem is sending a list of 400 widgets with every single page load, then you have an easier and better way to increase performance sitting right in front of you.
Re:Browsers are pretty good at loading pages by grishka on Monday July 22, 2019 @05:10AM (#20496365)
When I want to read an article, I don't need a "web application". I want a static page with the text and the pictures. That's it. Not a single line of JavaScript. And certainly absolutely no image lazy-loading nonsense. If my data is that limited, I'd disable images myself in my browser settings, thank you very much.

What I'm trying to say is that most of the web isn't really that interactive. It's mostly comprised of content that is static in its nature.

Re:Browsers are pretty good at loading pages by oefrha on Monday July 22, 2019 @06:59AM (#20496846)
> If my data is that limited, I'd disable images myself in my browser settings, thank you very much.

Yeah, because most visitors to most websites can and know how to disable images in browser settings.

In fact, let me know how to do this in iOS Safari. Before you tell me to throw my iPhone and iPad in the trash, get an Android, root the damn phone, install F-droid, compile Chromium with patches, or write my own operating system, now is a good time to stop.

I seriously hope this sort of condescending “elitist” bullshit would die off.

Re:Browsers are pretty good at loading pages by TeMPOraL on Monday July 22, 2019 @07:35AM (#20497000)
> Yeah, because most visitors to most websites can and know how to disable images in browser settings.

Maybe they would, if the UX culture of these days wasn't removing every feature that isn't used on every interaction, and then devs wouldn't try to build increasingly complex reimplementations of browser features on each page.

In an ideal world, lazy loading of images would be something handled purely by the browsers, and users would be aware how to operate it. The site's job is to declare what it wants to show; the User Agent's job is to decide what to show, when and how. But nah, the web culture prefers to turn browsers into TVs.

Re:Browsers are pretty good at loading pages by vthriller on Monday July 22, 2019 @08:17AM (#20497250)
> In fact, let me know how to [disable image loading] in iOS Safari

Given any browser, how do I reload a lazy-image that failed to load, without resorting to whole page refresh or diving deep into the Web Inspector?

Most browsers have a context menu option to reload regular images, but they cannot and will never handle a bunch of dynamic block elements with background-image option.

Re:Browsers are pretty good at loading pages by oefrha on Monday July 22, 2019 @10:55AM (#20498549)
Any reasonable img lazyloading implementation should produce plain img tags once loaded. Not sure why you would end up with background-image’d block elements.
Re:Browsers are pretty good at loading pages by yellowapple on Monday July 22, 2019 @11:14AM (#20498757)
"once loaded" is the key. If it fails to load, then bummer, no img tag.

I'm also not sure about the background-image'd block elements, for what it's worth.

Re:Browsers are pretty good at loading pages by oefrha on Monday July 22, 2019 @12:45PM (#20499769)
If it failed to load, it would leave behind an img tag that failed to load, like any non-lazy-loaded image. Unless you’re talking about JavaScript code failing to generate an img tag (e.g. from a data-src attribute), which would be bizarre.

Edit: by “once loaded” I meant once loading is triggered, if I wasn’t clear enough.

Re:Browsers are pretty good at loading pages by freehunter on Monday July 22, 2019 @10:40AM (#20498389)
>It's mostly comprised of content that is static in its nature

Yes, but the readers of the content are not the only customers the site is built for. The people writing and editing content are also consumers of the site. The article isn't (and doesn't have to be) interactive, but the CMS on the backend is. The advertiser's portal is. The reporting dashboards are.

Just like how Ruby on Rails is slow but we deal with it because it makes programming so much faster, dynamic websites are slow but we deal with it because it makes their administration so much faster.

Re:Browsers are pretty good at loading pages by yellowapple on Monday July 22, 2019 @11:08AM (#20498696)
The authoring tools and the published article don't have to (and I'd argue shouldn't) be joined at the hip like that, though. Obviously the editing tools benefit from being JS heavy. That doesn't justify polluting the published article itself with JS (unless the readers are editing the article themselves? Even then, though; Wikipedia seems to get by just fine without trying to replace half my browser with shitty JavaScript code).

> Just like how Ruby on Rails is slow but we deal with it

Not all of us :)

Re:Browsers are pretty good at loading pages by adrianN on Monday July 22, 2019 @01:14AM (#20495472)
In pretty much the same time it takes for the HTTP 200 to arrive I can also download a few kilobytes of HTML. Latency will still dominate.
Re:Browsers are pretty good at loading pages by nzjrs on Monday July 22, 2019 @02:45AM (#20495804)
> Only for the narrow > condition of loading a whole > page

It is an interesting future we live in, is it the best one?

Re:Browsers are pretty good at loading pages by StavrosK on Sunday July 21, 2019 @05:35PM (#20493817)
Case in point, navigation on my site is pretty fast (to me, at least) and doesn't use much JS at all: https://www.stavros.io

(I promise I'll reply to your email soon)

Re:Browsers are pretty good at loading pages by jspash on Sunday July 21, 2019 @05:40PM (#20493841)
I'll admit it is pretty fast. Assuming you are using a mouse. But keyboard navigation is non-existent. So you have to ask yourself is it worth it to go against decades of effort put in to standard web navigation for what gain? Obviously only you can answer that for your blog. I'm not having a go.

But I will give you credit for the fact that it does work with Lynx!

Re:Browsers are pretty good at loading pages by TeMPOraL on Sunday July 21, 2019 @05:44PM (#20493858)
By "keyboard" I assume you mean TAB-key-based navigation (I don't know of any other included in the browsers)? If so, it looks to me that links are in fact TAB-stops, but they're not being highlighted. It's something that should be solvable with a CSS adjustment.
Re:Browsers are pretty good at loading pages by quazar on Sunday July 21, 2019 @06:11PM (#20493986)
If the links are not highlighted by default, then tab navigation is basically non-existent since I cannot see where I'd be redirected and I personally bother to write custom CSS only for the websites I visit very often.

Is there an actual reason to disable highlighting? It lowers usability and accessibility, but I'm not sure what do you get in return?

Re:Browsers are pretty good at loading pages by StavrosK on Sunday July 21, 2019 @06:19PM (#20494032)
Oops, I'll fix that, thank you. I'm assuming the designer thought it looked "better".

Also I use Vimium so I never noticed, since that mode of navigation is much faster.

Re:Browsers are pretty good at loading pages by extra88 on Sunday July 21, 2019 @07:30PM (#20494365)
> Is there an actual reason to disable highlighting?

Some browsers, Chrome especially, show the focus outline when elements are clicked with a mouse and some people think it looks unacceptably bad.

Focus-visible is a CSS property meant to solve that but it’s only supported in Firefox and requires browser heuristics to do the right thing.

https://caniuse.com/#feat=css-focus-visible

https://css-tricks.com/keyboard-only-focus-styles/

Re:Browsers are pretty good at loading pages by yc12340 on Sunday July 21, 2019 @11:20PM (#20495134)
...also known as "directional navigation" — widely used by screen readers and browsers on Android TV or some Android Auto devices.
Re:Browsers are pretty good at loading pages by ComputerGuru on Sunday July 21, 2019 @11:19PM (#20495132)
Yeah, but you force me to stare at blank spaces while your webfont downloads [0]. I guess I should be thankful you’re not using that font for the body text, too (most sites do!).

[0]: https://imgur.com/a/FAX6BDW

Re:Browsers are pretty good at loading pages by adrianN on Monday July 22, 2019 @01:16AM (#20495482)
I just set browser.display.use_document_fonts to 0 in about:config.
Re:Browsers are pretty good at loading pages by weego on Monday July 22, 2019 @01:48AM (#20495598)
That's conflating two different issues
Re:Browsers are pretty good at loading pages by TeMPOraL on Monday July 22, 2019 @03:24AM (#20495926)
It's the same meta-problem, though: modern webdev practices involving adding gimmicks for no good reason that introduce extra complexity and resource use, and then adding even more complexity and resource use trying to fix all the expected behavior and features of browsers that the initial gimmick broke... and doing it poorly.
Re:Browsers are pretty good at loading pages by kilburn on Monday July 22, 2019 @09:51AM (#20497939)
I hate all these gimmicks you are talking about (slow to load fonts, unnecessary videos, fucked up scrolling, spinners everywhere, etc.).

That being said I challenge the assertion that they are used for no good reason.

- Custom fonts are used because they help shape a brand. Properly used, the choice of fonts communicates a lot (at a subconscious level) about the company or person behind it.

- Unnecessary videos unfortunately work (i.e., help grab and retain user attention). Not for me (quite the contrary!), but for the majority of people stumbling upon a company's website.

- Same for weird gimmicks involving animations and what not. I can feel them draining my battery out and it phisically hurts, but most people like them and take away the impression that "this is a modern person/company".

All in all, many website's primary goal is not to communicate factual information, but to capture user attention and/or communicate at a subconscious level, and gimmicky things work for that purpose :S

Re:Browsers are pretty good at loading pages by ComputerGuru on Monday July 22, 2019 @07:56PM (#20503345)
This idea that users need to see all text on your website in a particular font face (which is usually just a poorly packaged riff off of a famous font with minor changes that will largely go unnoticed by the unwashed masses) in order to market your product is absolute BS. Aside from a very few iconic font associations (e.g. IBM), there's no actual evidence that it actually works.

I fully support using a custom font for your visual assets - that's what SVG with text exported as curves/outlines was created for. But why should I use your horribly hinted, terribly rendered, absolutely illegible webfont (and have to download it to boot) just to read the copy on your website? Why should anyone?

Look at Apple. Despite what I'm sure their design team tells them, even they don't have an iconic font. They've bounced around between Helvetica, Myriad, Lucida, and a half-dozen other sans serif fonts that share certain design traits (which people do identify and associate in general), yet each time they introduce a new font they update their website to trigger your browser to download the webfont to render the page. It's a pointless exercise in the name of job security.

Companies have had websites going back 30 years. Web fonts have existed for a long time. This trend of each company having to pay tens of thousands to commission an unrecognizable, undistinguishable typeface that all text on their website must appear in is a brand new phenomenon, and there's zero proof it does anything besides (poorly) accomplish what someone thought was a good idea.

Re:Browsers are pretty good at loading pages by TeMPOraL on Monday July 22, 2019 @04:29PM (#20502021)
I agree; I cheated by purposefully using both meanings of "good". The reasons you mention I consider bad in ethical sense, and I believe the world would be better off if sites didn't do it.
Re:Browsers are pretty good at loading pages by TeMPOraL on Sunday July 21, 2019 @05:49PM (#20493882)
About as fast as mine on my underpowered machine, and mine is plain HTML without much attention paid to optimizing it further.

> (I promise I'll reply to your email soon)

(Take as much time as you need; also, I didn't expect a reply over the weekend :).)

Re:Browsers are pretty good at loading pages by greenhatman on Sunday July 21, 2019 @06:39PM (#20494114)
It's not as fast as https://dev.to/, which is an SPA. I.e. client side routing.
Re:Browsers are pretty good at loading pages by detaro on Sunday July 21, 2019 @06:55PM (#20494193)
And it took me 2 minutes clicking around to break its idea of the page state. I am partially scrolled down the home page, and it just decided to deactivate scrollbars and the ability to scroll.

A great example of how it's quite difficult to reimplement stuff that works perfectly well on traditional pages.

(At least they seem to haven gotten rid of some of the dark patterns they had in the past, that's nice to see)

EDIT: and within a minute more found another state bug :D

Yes, you can make perfect SPAs, but many people fail and it's a good question if the effort required to do it properly is worth it.

Re:Browsers are pretty good at loading pages by greenhatman on Sunday July 21, 2019 @07:43PM (#20494412)
I've never found a bug on there, and I've been on it many times.

I'd love if you can show me how to reproduce this bug.

I just don't have this experience with SPAs breaking. I actually have no idea where it's coming from.

Re:Browsers are pretty good at loading pages by wvenable on Monday July 22, 2019 @12:50AM (#20495405)
I just reproduced it following the commenters instructions -- clicked the sidebar link, got a popup, pressed the back button and I have no scroll bar.

I can see what is happening there: the popup removes scrolling (because of the overlay) but the back button doesn't restore it.

This certainly does lend to the conclusion that managing page state in a SPA is not trivial.

Re:Browsers are pretty good at loading pages by detaro on Sunday July 21, 2019 @08:30PM (#20494602)
It doesn't happen 100 % of the time, but right now going to the homepage, clicking one of the listings in the "newest listings" box, and then returning to the homepage through the browser back button triggered it.
Re:Browsers are pretty good at loading pages by nkurz on Sunday July 21, 2019 @10:05PM (#20494908)
I am able to reproduce this bug with Safari on a Macbook. I clicked on an item in "newest", then quickly pressed Cmd-Left to return to the previous "page". The front page reappears, but I'm unable to scroll with arrow keys or trackpad. An additional press of Esc returns the expected functionality.

It seems to be a fast and responsive site when it works, though.

Re:Browsers are pretty good at loading pages by nathan_long on Monday July 22, 2019 @06:35AM (#20496736)
> It seems to be a fast and responsive site when it works, though.

LOL.

Y'all, I love speed as much as anyone, but your development priorities should be 1) it works and 2) it's fast.

Using HTML links where 1) is never in doubt and all focus can be placed on 2) seems like good engineering to me.

Reinventing browser navigation is like building a rocket. You should be really, really sure that you need to do it before you try.

Re:Browsers are pretty good at loading pages by wlesieutre on Monday July 22, 2019 @12:55AM (#20495417)
Ah, the good old “footer at the bottom of an infinitely long page.”

Facebook and Google used to be guilty of this, but it’s been a while since I ran into that particular brand of user-hostile web design.

Re:Browsers are pretty good at loading pages by wlesieutre on Monday July 22, 2019 @09:09AM (#20497630)
Addendum - I may have been too harsh here. The page most likely is not infinite. You should able to scroll through the entire backlog of dev.to content to access the footer.

Seriously though, you can't just bolt infinite scrolling into the middle of an existing page if you have content at the bottom.

If anyone's curious, the footer contains: Home, About, Privacy Policy, Terms of Use, Contact, Code of Conduct, DEV Community copyright 2016 - 2019

They've duplicated most of that (but not the copyright) in the sidebar's "Key Links" box, so it's not as big a problem as I've seen on other sites.

If they hadn't, I wonder about the legal implications of making your privacy policy, terms of use, and copyright notice completely unreachable. And why keep them in the footer if you never leave it on screen long enough to click it? Just a "not my job" issue with whoever implemented the continuous scroll? Clearly someone thought about it long enough to put the links somewhere reachable, but not long enough to get rid of the old ones?

Re:Browsers are pretty good at loading pages by tener on Sunday July 21, 2019 @06:58PM (#20494213)
It is fast, but it breaks even faster. Managed to get myself in locked up state in some 15 seconds. Couldn't go back, displayed page was incomplete but no scrollbars were to be seen.
Re:Browsers are pretty good at loading pages by mikeash on Sunday July 21, 2019 @08:30PM (#20494600)
Good: it detects when you’re offline and displays a fun error page.

Bad: this only works on every other click. Half the time the links just silently fail....

Re:Browsers are pretty good at loading pages by StavrosK on Monday July 22, 2019 @09:50AM (#20497930)
For me, it always displays the "you're offline" page.
Re:Browsers are pretty good at loading pages by mikeash on Monday July 22, 2019 @10:16AM (#20498146)
A good demonstration of one of the major hazards of reinventing basic functionality like this: it’s really easy to end up with something that behaves differently on different browsers or just for different people.
Re:Browsers are pretty good at loading pages by couchand on Monday July 22, 2019 @03:20PM (#20501358)
You just reminded me that slate.com frequently tells me I'm offline after clicking the back button.
Re:Browsers are pretty good at loading pages by ldoughty on Sunday July 21, 2019 @09:07PM (#20494711)
How do I access the footer on mobile? It just keeps scrolling it down as soon as it appears
Re:Browsers are pretty good at loading pages by 9HZZRfNlpR on Sunday July 21, 2019 @08:50PM (#20494663)
Scrolling is extremely laggy on latest mid range Android using Chrome. Almost unusable.
Re:Browsers are pretty good at loading pages by StavrosK on Monday July 22, 2019 @09:48AM (#20497917)
That definitely seems faster, I'll give you that:

https://i.imgur.com/bx1LUZD.png

Re:Browsers are pretty good at loading pages by ec109685 on Monday July 22, 2019 @12:16AM (#20495306)
Scroll, click a story, click a link off the site and then hit back button twice. You will jump to top of homepage incorrectly.
Re:Browsers are pretty good at loading pages by aurelius83 on Sunday July 21, 2019 @09:25PM (#20494777)
Sure, I mean all you're doing is basically loading up static content. In which case SSR HTML will perform just fine, but you do happen to use client side logic for your comments section which also makes sense to me. A SPA for your site isn't really the use case for SPA.
Re:Browsers are pretty good at loading pages by arthurcolle on Sunday July 21, 2019 @06:29PM (#20494071)
Scrolling on the hamburger buttons is in my opinion much smoother on your site than on sites that force you to click their links in the page itself. I'll have to check out the source when I get home, its overall a great UX with a focus on functionality over form, but the form is still nice enough to get the job done!
Re:Browsers are pretty good at loading pages by thinkloop on Sunday July 21, 2019 @07:26PM (#20494346)
Your site is great and the perfect usecase for traditional links, but it's literally like 99% content, with very little markup. The difference is more stark on design heavy pages.
Re:Browsers are pretty good at loading pages by onion2k on Monday July 22, 2019 @01:41AM (#20495565)
... loading times of pure HTML webpages on good connection are so fast they whole thing outruns client-side page switches even if the page is already in memory.

Unfortunately for us front end engineers we can't rely on the user having any internet connection let alone a good one. Most of the push behind static site generators is to get as much of the code necessary to display all the website in to your browser as fast as possible, so it's there no matter what happens later. In cases where the user has a fast, robust connection that may well be slower than loading each page on demand, but in cases where the user's connection is slow and flaky (eg on a train) static sites generators do work better.

Perhaps the next generation of websites will take your connection in to account better. It depends on whether browsers and users will be willing to give up that information though. As far as I'm concerned I will use everything I can to improve the user experience on the sites I build.

Re:Browsers are pretty good at loading pages by dijit on Monday July 22, 2019 @03:02AM (#20495856)
Well. I can speak from a pretty solid experience here. I’ve travelled the US by train, the length of the UK by train and large swathes of Europe by train.

The site that tends to be the best to use is the ones that don’t take much to load. Connection tends to be spotty, you get bouts of “some” data and then you’re dry again for a while. If you can squeeze a page load in there it’s infinitely better than a half opened page.

Your first page load is -incredibly- important here. It’s the difference between a usable site and an unusable one.

The sites that work the best are the ones that do not try to do very much fancy stuff, because that fancy stuff only half-loads most of the time; leaving you to keep refreshing and hoping the spotty connection finally lets you bring in that 2KiB that will allow the page to actually load.

Re:Browsers are pretty good at loading pages by onion2k on Monday July 22, 2019 @03:22AM (#20495923)
Your first page load is -incredibly- important here. It’s the difference between a usable site and an unusable one.

This is the point I was making. If the server can send the user enough data on the first load to make the whole app/site usable then the user won't need to wait for the network if they're in a tunnel. They've already got the necessary resources (which shouldn't be everything, just what's necessary). In that scenario client side routing beats server side completely because server side rendering just doesn't work when the user doesn't have a network connection.

That said though it's wasteful and entirely unnecessary if the user has a good connection. Really websites should have a good mechanism for testing. The Network Information API doesn't have particularly good cross browser support and it isn't especially reliable yet.

Re:Browsers are pretty good at loading pages by TeMPOraL on Monday July 22, 2019 @03:50AM (#20496039)
If. There are two failure points here, both of which are so frequent that I can't even recall seeing an exception.

One, if your first page load tries to load a full page, instead of just some JS that bootstraps the process of loading of the rest of the page, which lets the first load finish before execution. Better yet, it should load the absolute minimum bit of JS site kernel. Then, the first load is likely to succeed on a slow/spotty connection, and we can skip to problem #2 below. This isn't being done correctly in most of the sites I visit for some reason; the first page is either attempted to be downloaded in full, or the "skeleton" of the UI is the piece that always loads the longest.

Two, loading UX. You have a loaded UI skeleton with boxes that need to be filled via further requests. Or, I've clicked on something and a subsection of the site needs to be refreshed. What happens is either nothing, except the SPA getting unresponsive, or I get the dreaded spinners everywhere. If the requests succeed, the spinners eventually disappear. If they don't, they don't. Contrast it to the pre-JavaScript style: if something needs reloading, my page is being rendered essentially top-to-bottom, complete bit of contents popping up as they're loaded; the site is usable in partial state, and if anything breaks, I get a clear error message.

Can this two problems be solved correctly in client-side rendered code? Yes. Can SPA be faster than full page loading? Yes. Is it usually? No, because web development is a culture. When a company decides "let's do SPA" or "let's do client-side rendering", they unfortunately inherit almost all the related dysfunction by default.

Re:Browsers are pretty good at loading pages by dijit on Monday July 22, 2019 @04:18AM (#20496167)
I think you're not making the same point as me at all.

I'm going to take the common case of a news article;

Imagine for a second, you're on a train and you have low bandwidth internet, when it works, which is rare. Now you're on hackernews and you've loaded a whole comment thread, you're reading through and someone posts a link to your article.

Now, the article can load with client side routing, but will take longer. And depending on implementation might not actually have the whole article.

The page which is pure html with minor javascript is going to load, in full, and I don't need subsequent requests. And, it's guaranteed to be smaller than the one that you're over-engineering.

Re:Browsers are pretty good at loading pages by yellowapple on Monday July 22, 2019 @11:33AM (#20498963)
I have a family friend who lives in a part of the US where the only options are dial-up and satellite. He thus uses dial-up.

Without fail, the sites that rely heavily on JS to do page loading end up performing significantly worse (and in fact outright bugging out, and often failing to load entirely) than sites which just send ordinary HTML docs. A disturbingly-high number of the JS-heavy "web apps" out there seem to have little regard for actually handling failures on a sketchy connection.

Your point would make more sense in the context of an Electron app or something with a permanently-locally-cached copy of the site. That would at least give my elderly friend the means to predownload it when he piggybacks off the public wifi when he goes into town.

Re:Browsers are pretty good at loading pages by nathan_long on Monday July 22, 2019 @12:31PM (#20499630)
> Unfortunately for us front end engineers we can't rely on the user having any internet connection let alone a good one.

Surely some web apps need to work offline. But most web pages do not, and I don't want most sites I visit to store a bunch of data on my machine on the off chance that I'll use them offline.

"Offline first" seems really misguided to me as a rallying cry for all things on the web.

Re:Browsers are pretty good at loading pages by jbergens on Monday July 22, 2019 @08:19AM (#20497266)
The article only tested one site with one browser, hardly a good test. It may be correct anyway but it IS not a proof.

It may also be much harder to implement something like a comment section that is fast and correct with only static html and a server backend.

Re:Browsers are pretty good at loading pages by dan-robertson on Monday July 22, 2019 @08:38AM (#20497393)
I don’t understand why doing things the non-JavaScript way wouldn’t be correct. Surely you still need to do all the correctness things on the server anyway even if you do some in JS because client side validation won’t stop other people (or spammers) from sending invalid requests to the server. When I think of a correctness problem it would be in keeping the js-rendered comment section synchronised with the server-side comment section which seems harder than making it work with no js.
Re:Browsers are pretty good at loading pages by shard972 on Sunday July 21, 2019 @10:11PM (#20494925)
> webpages on good connection are so fast

Not everyone has this, espicially when your someone like myself who writes informational websites for people who won't be connected to any internet for hours at a time.

Super fast response times don't cut it when your response time is non existent at the moment.

Re:Browsers are pretty good at loading pages by throwaway2048 on Sunday July 21, 2019 @11:41PM (#20495203)
If your internet connectivity breaks constantly, there is a good chance that a JS heavy client side app is going to irrecoverably break, require a hard refresh and take much longer to load because of your crap internet.

I should know, my internet connectivity sucks, and single page applications are almost without exception, a completely awful experience.

Re:Browsers are pretty good at loading pages by enraged_camel on Sunday July 21, 2019 @08:05PM (#20494510)
I don’t think blogs are a good example. How much complex logic do they have, and how many database queries and data processing do they do before they serve their content? Furthermore, how much interactivity do they have? Not much.
Re:Browsers are pretty good at loading pages by TeMPOraL on Monday July 22, 2019 @03:39AM (#20495989)
I'd guess as much as 90% of pages out there - fetch a blob of data from the server, render it, and have most interactions not touch the server at all.

You can view e.g. ecommerce sites as blogs with one post per combination of (search query, filter switches, page selected). This necessitates frequent shots to server, but the site otherwise transfers roughly a page's worth of data per viewed page. I've never seen an on-line shop that was made better by being an SPA, over an old-school page reload every click.

Similarly discussion forums - there's Discourse that's arguably more gimmicky with its client-side magic; beyond that, if you want to see what would happen if you turned HN into an SPA, look no further than the dumpster fire the new Reddit design is.