index.html
<html><head>
<meta charset="utf-8">
<script src="https://code.jquery.com/jquery-2.1.3.min.js></script>
</head>
<body>
<hr>簡易速度測定サイト<hr>
<div><script type="text/javascript">
var speedtest = function() {
jQuery.ajaxSetup({
cache: false
});
var start = (new Date()).getTime();
jQuery.get('/適当なサイズのファイル1MBぐらい.bin', function(data) {
var end = (new Date()).getTime();
var sec = (end - start) / 1000;
var bytesPerSec = Math.round(data.length / sec);
speed = bytesPerSec * 8 / 1000 / 1000;
alert(speed.toFixed(2) + "M bps");
});
};
</script></div>
<input name="speedtest" type="button" value="測定開始" onclick="speedtest()" />
</body></html>