How to detect internet speed in JavaScript?

前端 未结 9 1597
萌比男神i
萌比男神i 2020-11-22 01:56

How can I create a JavaScript page that will detect the user’s internet speed and show it on the page? Something like “your internet speed is ??/?? Kb/s”.

9条回答
  •  暗喜
    暗喜 (楼主)
    2020-11-22 02:40

    I needed something similar, so I wrote https://github.com/beradrian/jsbandwidth. This is a rewrite of https://code.google.com/p/jsbandwidth/.

    The idea is to make two calls through Ajax, one to download and the other to upload through POST.

    It should work with both jQuery.ajax or Angular $http.

提交回复
热议问题