News for hackers. Stuff that matters.
Re:Add limits to amount of JavaScript that can be loaded by ... by lmilcin on Wednesday January 30, 2019 @02:30PM (#19038409)
Uh... this is wrong on so many levels.

What is going to be the limit?

Who is going to be setting it?

How is it going to be calculated? Is it the amount of loaded files? What if the page is small but then loads more dynamically later?

How I, as a developer, make sure my website works everywhere?

What with sites that use a lot of code but still work fast? The amount of code does not directly translate to slowness. You can have little code and slow website or a lot of code and fast website. As an example, single page applications tend to load all of its code but still manage to be responsive.

Re:Add limits to amount of JavaScript that can be loaded by ... by kbenson on Wednesday January 30, 2019 @02:45PM (#19038609)
If I was responsible for setting the agenda...

> What is going to be the limit?

Whatever the user wants it to be.

> Who is going to be setting it?

A default from the browser, which can be overridden by the user.

> How is it going to be calculated? Is it the amount of loaded files? What if the page is small but then loads more dynamically later?

Preferably by a total per-site and per page (with page being a higher amount than site). When a site/page hits its limit, halt running with a popup asking for a temporary larger limit (and a checkbox to remember the limit for this site).

> How I, as a developer, make sure my website works everywhere?

The same way you, as a developer, make sure it works everywhere with Javascript features. You find a sane maximum by the lowest of all the browsers that support it. If you figure out what IE, Chrome, Firefox and Safari (and their mobile equivalents) have as limits, you've basically solved the problem.

> What with sites that use a lot of code but still work fast? The amount of code does not directly translate to slowness.

Depending on your connection, it really does. Bad mobile connections (even if only in certain locations, like supermarkets that are constructed like Faraday cages) mean that an increase in the size of the JS loaded required to use the page directly translates into extremely slow websites, and in a lot of contexts, the first page is the only page visited, so the idea that a SPA will be quick after that first load (to stave off that future point) doesn't really solve the problem.

Re:Add limits to amount of JavaScript that can be loaded by ... by throwawayy1001 on Wednesday January 30, 2019 @02:35PM (#19038493)
> What is going to be the limit?

He suggests 1mb, personally I still think it is too much.

> How I, as a developer, make sure my website works everywhere?

1mb for a single page isn't enough?

> What with sites that use a lot of code but still work fast?

It's fast if the resources are near your device (CDN), most websites don't do that at all.

Re:Add limits to amount of JavaScript that can be loaded by ... by apalmer on Wednesday January 30, 2019 @02:57PM (#19038759)
I think we already do this. Its built into the fabric of the web. Not sure why we are proposing arbitrary limits and additional user opt in for this.

Wether a website wants to be inefficient or has a good reason for having a lot of resources it impacts the speed with which the site loads. The slower the site loads the more users are going to abandon the site. Stats say by 2 seconds most users have abandoned a slow loading site. Caveat that if the user feels the site is really worth the wait, they will wait longer.

So seems everything in this proposal is already addressed...

Re:Add limits to amount of JavaScript that can be loaded by ... by nicoburns on Wednesday January 30, 2019 @02:45PM (#19038612)
> 1mb for a single page isn't enough?

What about single-page apps where the whole app is "a single page". With this proposal, even lazily loading the extra bits would hit the limit.

Re:Add limits to amount of JavaScript that can be loaded by ... by krapp on Wednesday January 30, 2019 @03:28PM (#19039089)
I strongly suspect the true purpose of this would be to make javascript unusable for all but the most trivial cases, and to train end users to fear it like a virus, or find its presence annoying, making it an anti-feature. Killing SPAs would probably be a feature in that case.