Skip to content

Instantly share code, notes, and snippets.

@VorticonCmdr
Created October 11, 2018 06:36
Show Gist options
  • Save VorticonCmdr/632de5c3a3ff382ed4b0b2aa7678f7d8 to your computer and use it in GitHub Desktop.
Save VorticonCmdr/632de5c3a3ff382ed4b0b2aa7678f7d8 to your computer and use it in GitHub Desktop.
<!doctype html>
<html lang="en" prefix="og: http://ogp.me/ns#">
<head>
<meta charset="utf-8"/>
<title>Google Fetch and Render test</title>
</head>
<body>
<span>useragent</span>
<p id="uaOutput"></p>
<span>random number</span>
<p id="randomNumber"></p>
<span>fetch result</span>
<p id="fetchType"></p>
<script>
var randomNumber = document.getElementById('randomNumber');
randomNumber.textContent = Math.random();
var uaOutput = document.getElementById('uaOutput');
uaOutput.textContent = navigator.userAgent;
var fetchType = document.getElementById('fetchType');
fetch('/abc.txt').then(function(response) {
response.text().then(function (text) {
fetchType.textContent = text;
});
}).catch(function(err) {
fetchType.textContent = err;
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment