Skip to content

Instantly share code, notes, and snippets.

@mosfet1kg
Created April 13, 2017 12:07
Show Gist options
  • Save mosfet1kg/3d157cf6d1403c2da9587a11d34eabb6 to your computer and use it in GitHub Desktop.
Save mosfet1kg/3d157cf6d1403c2da9587a11d34eabb6 to your computer and use it in GitHub Desktop.
resource timing api example
<!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