Question

Is there a way to alert a visitor that the website may load slowly because of their slow connetion?
i.e.
Heads up!
The page seems to be loading slowly becasue of your connection. Please allow extra time for the website to load.

Était-ce utile?

La solution

You may download a known payload using ajax. Note down the request begin time and end time. If that is beyond some threshold you may alert the user about slow connection. For example, you download a 100 kb payload. You know under normal situations it takes 2 seconds. You may alert the user about slow network if it goes beyond acceptable threshold of say, 5 seconds. The payload you download need not be a waste request - you may use any ajax request for detecting the slow connections. This will work with one big assumption - your server is always responding quickly under heavy loads too - indicating only source of slow response is because of user's network conditions.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top