Checking someones bandwidth and loading content based on it

后端 未结 6 1623
忘掉有多难
忘掉有多难 2021-02-14 21:29

I have seen a number of questions that don\'t answer this, is it possible to check someones bandwidth using java script and load specific content based on it?

The BBC se

6条回答
  •  忘了有多久
    2021-02-14 22:08

    1. Start a timer.
    2. Send a AJAX request to your server, requesting a file of known size.
    3. When the AJAX request's done loading, stop the timer, and calculate the bandwidth from the passed time and file size.

    The problem with JavaScript is that users can disable it. (Which is more common on phones, that happen to be better off with smaller images)

提交回复
热议问题