forked from UCA-Squad/ucastudio
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcheckSpeedNtwk.html
29 lines (27 loc) · 1.05 KB
/
checkSpeedNtwk.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<script type="text/javascript" src="static/js/jquery.min.js" ></script>
<script>
$(function() {
var settings = {
endpoint: 'checkSpeedUpload', // Where is located the PHP file.
upload: {
// Where is located your `network.php` file.
// The delay while you want to take measures.
delay: 8000,
data: {
// The amount of data to initially use.
size: 2 * 1024 * 1024, // 2 MB
// If the measure period can't reach the delay defined in the settings,
// the data amount is multiplied by the following value.
multiplier: 2
}
}
};
var net = new Network(settings);
net.upload
.on('end', function(averageSpeed) {
var finalValue = (averageSpeed/1024/1024)*8;
window.parent.postMessage(finalValue, '*');
})
.start();
});
</script>