Check Internet speed using JavaScript to render elements conditionally
The downlink read-only property of the Network
Information interface returns the effective bandwidth estimate in megabits per second, rounded to the nearest multiple of 25 kilobits per seconds. This value is based on recently observed application layer throughput across recently active connections, excluding connections made to a private address space.
if (navigator.connection.downlink < 5){
//logic for bad internet speeds
} else {
//logic for good internet speeds
}
Top comments (3)
mmmm... around 65% of usage: caniuse.com/mdn-api_navigator_conn... and in Firefox you need authorize the feature
Good idea, but it need to be checked before to use :)
(see developer.mozilla.org/en-US/docs/W... )
Bravo
The things Javascript can do are pretty amazing!!