/* HTML5 Speedtest v4.6.1 MPOT - Server selector by Federico Dossena https://github.com/adolfintel/speedtest/ GNU LGPLv3 License */ //pings the specified URL, then calls the function result. Result will receive a parameter which is either the time it took to ping the URL, or -1 if something went wrong. //var PING_TIMEOUT=500; //disabled because it breaks IE11 function ping(url,result){ var xhr=new XMLHttpRequest(); var t=new Date().getTime(); xhr.onload=function(){ if(xhr.responseText.length==0){ //we expect an empty response var instspd=new Date().getTime()-t; //rough timing estimate try{ //try to get more accurate timing using performance API var p=performance.getEntries(); p=p[p.length-1]; var d=p.responseStart-p.requestStart; if(d<=0) d=p.duration; if(d>0&&d=0){ if(t