forked from bizzbyster/bizzbyster.github.io
-
Notifications
You must be signed in to change notification settings - Fork 0
/
nav_timing.html
28 lines (27 loc) · 860 Bytes
/
nav_timing.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
<!doctype html>
<html>
<head>
<title>Nav Timing Test Page</title>
</head>
<body>
<h1>Nav Timing Test Page</h1>
<img src='https://raw.githubusercontent.com/bizzbyster/bizzbyster.github.io/master/images/zip-icon.png'>
<script>
var reqCount = 0;
var myReq = new XMLHttpRequest();
myReq.open('GET', url, true);
myReq.onload = function(e) {
window.performance.mark('mark_end_xhr');
reqCnt++;
window.performance.measure('measure_xhr_' + reqCnt, 'mark_start_xhr', 'mark_end_xhr');
var items = window.performance.getEntriesByType('measure');
for (var i = 0; i < items.length(); ++i) {
var req = items[i];
document.write('XHR ' + req.name + ' took ' + req.duration + 'ms');
}
}
window.performance.mark('mark_start_xhr');
myReq.send();
</script>
</body>
</html>