DEV Community

miguel-penaloza
miguel-penaloza

Posted on

How to survive to Chrome for Android disabling JavaScript for 2G or slower connections?

I found this article and after reading carefully I start thinking a lot about that, I will share with your the link right here.

What basically says is that Google is considering the idea of disable JavaScript in his browsers for slow internet connections in Android and maybe in the future for all his versions.

Looks like an odd move from Google, if this comes true, how the JS world will survive?

Today we cannot talk about Front-end or Web development without talk about JavaScript. Now we have very popular frameworks and libraries like React, Angular, Vue, etc. And almost a new JS framework every month(or week?).

I was thinking in how work with this new scenario, maybe use some progressive Enhancement, create phantoms layout before render anything, and realize that now we not only have to support old browsers but also slow networks.

What scares me about the idea of disable JS when the network become slow, is what new weird behaviours and bugs can we have to support? If now we should handle that a browser will shoot down your app, will we have that states (onJsDisabled?)? How the new net neutrality regulations will affects the speed in our sites?

Maybe I'm a little paranoid, but I wanna know what the community thinks about this? how this posible change can affect us? And how to deal with it?

Best regards.
A worried Dev.

Top comments (3)

Collapse
 
rhymes profile image
rhymes

A part of me is quite happy about this.

If you read The Cost of JavaScript in 2018 you will realize that the "average" Android Phone is not a Pixel, it's a Moto G4 and many people (I see them on public transportation all the time) have sub 100-150$ phones like the one mentioned, the Alcatel 1X.

So if you have an average or below average phone and a slow connection your mobile experience is quite frankly bad (65 seconds to load cnn.com on an Alcatel 1X on 3G).

So, in this light it makes perfect sense for a browser to disable JS if it detects that it's too slow. It might even make the web better: I would prefer the browser telling me right away "this site is too slow and it doesn't work" than waiting a full minute to open a page. This way I can go to a competitor's website ;-)

I think in the end this move could finally awake us from our "JS only stupor" and realize that most people don't have the latest iPhone and fiber optics anf force developers to create a basic website that can be used also by people without the latest tech.

Collapse
 
mangel0111 profile image
miguel-penaloza • Edited

Is a good point of view, but the thing's that this's not something that wont affect the latest iPhone (assuming that an iPhone user will use Chrome instead of Safari), the real thing is that you can have the most powerfull machine but a slower connection will block a user from content.

If I have an Alcatel 1X, and the most of the websites are displaying this site is too slow and it doesn't work is not a problem with the internet itself or the website is a problem with my cellphone and my provider.

This looks like a deprecating marketing strategy to make people pay for faster internet providers, maybe pay an extra fee to unlock some websites, and to force they to buy new phones that can use internet well (Or how these companies thinks that the internet should be used), with the new regulations about Net Neutrality a provider can set limits for certain sites and make it unavailable for all the Android Users. How can this affect a business? When his only mistake was build his site in React or Angular, even PHP, Java, .NET sometimes use JavaScript to validate forms and others stuffs.

Obviously, a web developer never should think that all his users will have 100 Mbps, that's wjhhy I mention Progressive Enhancement because is a good way to deal with this scenarios, also you can create a phantom layouts where you can split your web site loading in phases to avoid deliver all your resources in the first GET and reduce the network stress(I will write a post about this soon.) but scares me the idea of blocking everything even before start.

Collapse
 
rhymes profile image
rhymes • Edited

Is a good point of view, but the thing's that this's not something that wont affect the latest iPhone (assuming that an iPhone user will use Chrome instead of Safari), the real thing is that you can have the most powerfull machine but a slower connection will block a user from content.

The feature is enabled only on Android so it won't affect iPhone users.

If you read the article you linked at the beginning the answer is there:

This is huge news for developing countries where mobile data packets may cost a lot and are not be affordable to all. Enabling NoScript by default will make sure that users don’t burn through their data without knowledge

The point is duplicitous: save people's data (because we send them too much JS) and force web developers to think about graceful degradation.

If I have an Alcatel 1X, and the most of the websites are displaying this site is too slow and it doesn't work is not a problem with the internet itself or the website is a problem with my cellphone and my provider.

It won't be "most websites", it will be only those that are JS only.
If I disable JS and go to nytimes.com I can still see the website and read the news. I lose a lot of functionality, but not the essential one: reading the articles and seeing the pictures.

You're still not thinking about the fact that there's a immense chunk of people on the planet that can do mostly 2G or 3G. And how different the speeds of 2G and basic 3G are comparing to 4G:

mobile speeds

We're talking about 0.1MBit/s against 15Mbit/s. 150 times faster! I have 4G on my phone, I just ran a speed test and it's faster than my own ADSL.

My 4G goes to 13.5 MBit/s, my ADSL doesn't go past 8Mbit. We're miles away from the average experience of those in basic 3G or 2G.

I had 3G and 2G years and years ago and websites were not that slow, because we didn't throw SPAs at every problem ;-)

This looks like a deprecating marketing strategy to make people pay for faster internet providers, maybe pay an extra fee to unlock some websites, and to force they to buy new phones that can use internet well (Or how these companies thinks that the internet should be used), with the new regulations about Net Neutrality a provider can set limits for certain sites and make it unavailable for all the Android Users.

Aside from the fact that "net neutrality" is mostly an American problem (as far as I remember it is still illegal in Europe where I live), I don't think this is the case. If you live in rural USA or rural Poland or rural Zimbabwe where your phone connection is 2G at best, you're not going to get a faster connection anyway, until your ISP physically installs the necessary hardware. The issues with net neutrality are a different beast, and yes there they can make you pay to access this or that website but we're talking about a different thing: a browser that defaults to HTML only if the connection is too slow.

How can this affect a business? When his only mistake was build his site in React or Angular, even PHP, Java, .NET sometimes use JavaScript to validate forms and others stuffs.

That's the thing: it's not "only just a mistake". It's years and years of frienzed madness in which we convinced ourselves (I'm part of the problem here) that the world would be a better place if we were to send them megabytes of JavaScript, when in fact most frameworks are born to simplify the life of the programmer, not of the user (which totally doesn't care about which technology you used to make the website).

Frameworks are cool and neat but take a step back: do you really think that if your button is rendered by JavaScript or by HTML the user is going to care :-) ?

I mention Progressive Enhancement because is a good way to deal with this scenarios

Yeah but progressive enhancement used to mean: you have your website in HTML and CSS and then you add functionality with JS, if JS is turned off, you still have your website. Now most Vue/React/Angular websites with JS turned off are blank pages.

Keep in mind that you can't control what the user does on the client side.

A good read on the subject: Dear Developer, The Web Isn't About You.

Again, we need to do better.