0
I am trying to calculate the connection speed in MB of a user who access my site. But I couldn’t find much on the Internet other than ready-made programs and websites that already do that. The only thing I could do was calculate how long in milliseconds the page takes to load:
$(window).load(function () {
var endTime = (new Date()).getTime();
var millisecondsLoading = endTime - startTime;
console.log(millisecondsLoading);
// Put millisecondsLoading in a hidden form field
// or Ajax it back to the server or whatever.
});
But I don’t know how to use this to calculate a user’s MB connection speed!
tamanho da pagina(em mb)/tempo de carregamento(s)
. That’s the basic operation, I just can’t guarantee that it’s that simple.– user28595
Or what I see many sites do is send a file to the cache and calculate how long it was downloaded by the user altogether. The calculation is the same, only changes the procedure, instead of its entire page, a file apart.
– user28595
But with this formula it would be a bit tricky because every time I hear page change I will have to recalculate the size of it! :/
– alan