šŸ“™ Understanding Neuronal Networks presale is now open - 20% off discount!

We can use the Javascript navigator.connection object to detect if we are on a 3g, 4g or Wifi

Today I have found out that there is a navigator.connection object in Javascript that will give us information about the network speed of the client.

This is what I get if currently log it into my dev console.

Besides the actual connection type, we have access to info like downlink (estimated effective round-trip time of the current connection) or rtt (effective bandwidth estimate in megabits per second).

We can even have access to an event like NetworkInformation.onchange so that we can readjust our data usage based on the network type. You can see the full info here.

Keep in mind that it is still a work in progress so be sure to check the compatibility table. It is supported in approx 60% of the cases.

By the way, there is also a saveData attribute to detect in Javascript the prefers-reduced-data CSS prefers queries.

šŸ“– Neural Networks from Scratch - Presale

I'm writing a book about the timeless foundational concepts of neural networks for JavaScript developers. Go from if-else to weights and biases by building tiny AI models from scratch!

šŸ“– Neural Networks from Scratch - Presale

I'm writing a book about the timeless foundational concepts of neural networks for JavaScript developers. Go from if-else to weights and biases by building tiny AI models from scratch!


Leave a Reply

Your email address will not be published. Required fields are marked *