Created
April 13, 2017 12:07
-
-
Save mosfet1kg/3d157cf6d1403c2da9587a11d34eabb6 to your computer and use it in GitHub Desktop.
resource timing api example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html> | |
<head> | |
</head> | |
<body onload="loadResources()"> | |
<script> | |
function loadResources() | |
{ | |
var start = new Date().getTime(); | |
var image1 = new Image(); | |
var resourceTiming = function() { | |
var now = new Date().getTime(); | |
var latency = now - start; | |
alert("End to end qresource fetch: " + latency); | |
}; | |
image1.onload = resourceTiming; | |
image1.src = 'https://www.w3.org/Icons/w3c_main.png'; | |
} | |
</script> | |
<img src="https://www.w3.org/Icons/w3c_home.png"> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment