ソースを参照

add report timeout

MortyFx 4 年 前
コミット
c21fe4e463
1 ファイル変更5 行追加0 行削除
  1. 5 0
      index.html

+ 5 - 0
index.html

@@ -27,8 +27,13 @@ s.onupdate=function(data){ //callback to update data in UI
 	var addr = ipIspArr[2] === undefined? '' :ipIspArr[2];
 	var progress = Math.floor(100*prog);
 	if (progress > 20 && (progress % 10 == 0) && progress != milestone) {
+		console.log(progress);
 		var params = 'ip='+ip+'&isp='+isp+'&addr='+addr+'&dspeed='+I("dlText").textContent+'&uspeed='+I("ulText").textContent+'&ping='+I("pingText").textContent
 						+'&jitter='+I("jitText").textContent;
+		xhr.timeout = 3000;
+		xhr.ontimeout = function (e) {
+			console.log('上报超时');
+		};
 		xhr.open('POST', url_report, true);
 		xhr.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
 		xhr.send(params);