Skip to content

Instantly share code, notes, and snippets.

@VorticonCmdr
Created October 10, 2018 06:24
Show Gist options
  • Save VorticonCmdr/2dafbfcda1fa4f52f8e19c178c462fba to your computer and use it in GitHub Desktop.
Save VorticonCmdr/2dafbfcda1fa4f52f8e19c178c462fba to your computer and use it in GitHub Desktop.
google search console fetch & render test
<!doctype html>
<html lang="en" prefix="og: http://ogp.me/ns#">
<head>
<meta charset="utf-8"/>
<link rel="canonical" href=" [insert your url here] "/>
<title>Google Fetch and Render test</title>
</head>
<body>
<span>time diff</span>
<p id="speedOutput"></p>
<span>count</span>
<p id="countOutput"></p>
<span>useragent</span>
<p id="uaOutput"></p>
<script>
var uaOutput = document.getElementById('uaOutput');
uaOutput.textContent = navigator.userAgent;
var speedOutput = document.getElementById('speedOutput');
var countOutput = document.getElementById('countOutput');
var i = 0;
var startTime = (new Date().getTime());
setInterval(function(){
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4) {
var endTime = (new Date().getTime());
var diff = endTime - startTime;
speedOutput.textContent = diff;
i++;
countOutput.textContent = i;
}
};
xhttp.open("GET", " [insert your url here] ", true);
xhttp.send();
}, 1000);
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment