PHP Speed Test for user connection speed without echo in current page

后端 未结 7 1182
甜味超标
甜味超标 2021-01-13 00:25

I am looking for a possibility to check the user connection speed. It is supposed to be saved as a cookie and javascript files as well as css files will be adapted if the sp

7条回答
  •  粉色の甜心
    2021-01-13 01:09

    How about using javascript to time how long it takes to load a page. Then use javascript to set the cookie.

    microtime in javascript http://phpjs.org/functions/microtime:472

    Using jQuery

    
    
    
    
    
    
    

    some page to test how long it loads

    Some pitfalls: - The page would need to start loading first. JQuery would need to be loaded (or you can rework the above code to avoid jQuery)

    • testing speed on ASCII / Latin data may not give the best result, because the characters may get compressed. Besides the high level gzip compression, Some modems / lines (if not all) have basic compression that is able to detect repeating characters and tell the other end that the next 500 are repeat of ' '. I guess it would be best to use binary data that has been compressed

提交回复
热议问题