Is it possible to detect, through Javascript, whether the user is connected to a WIFI or high speed connection as opposed to a slow one? I’m trying to use something like that to load a compressed version of a video if the user is on a slow connection.
Like:
if (onwifi) {
//heavy video
} else { //light video}
Yes, you can gauge the connection speed.
Create a new
Dateobject, then use the DOM to download an image of a fixed size, with a random number appended on the end so the client doesn’t cache it. The image’sonloadevent should subtract the time before the image was downloaded from the current time, therefore giving you the number of milliseconds it took to download.