[英]how to check that how much page has been loaded
I am trying to make a progress bar through java script library progress.js
and i want to show that how much page has been. 我正在尝试通过Java脚本库
progress.js
制作进度条,我想显示多少页面。 I want to do this through my progress bar. 我想通过我的进度栏来做到这一点。 How can i check that how much page has been loaded?
我如何检查已加载多少页面?
May be your need to try by calculating response header size and then calculate %
您可能需要尝试通过计算响应头大小然后计算
%
var request = new XMLHttpRequest();
request.open('GET', document.location, false);
request.send();
var size = request.getAllResponseHeaders().toLowerCase().match(/content-length: \d+/);
alert(size);
You will get size in bytes. 您将获得以字节为单位的大小。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.