Checking for internet speed using Javascript

talent - Jun 15 '22 - - Dev Community

Check Internet speed using JavaScript to render elements conditionally

The downlink read-only property of the Network
Image descriptionInformation 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

}



Enter fullscreen mode Exit fullscreen mode
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Terabox Video Player