Home >Web Front-end >JS Tutorial >Script to use js to count the time it takes for users to download web pages_javascript skills

Script to use js to count the time it takes for users to download web pages_javascript skills

WBOY
WBOYOriginal
2016-05-16 18:59:591074browse

Sometimes, we may calculate multiple servers based on IP. Users in the south choose the server in the south, and those in the north choose the server in the north. However, we gradually find that there are often errors in using IP statistics. I have thought about using ping on the client before. The method is to see which server has a fast connection, but at least the user needs to install a plug-in. Now think about it, it seems that using js can also solve part of the problem


Calculated based on the difference between d2 and d1 The download speed of each server and client is stored in the cookie, and then compared, the faster one is selected. And after a certain period of time, the cookie is updated to make corrections.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn