Fetch API HTML Sample

Available in Chrome 42+ | View on GitHub | Browse Samples

Background

This sample shows how the Fetch API can retrieve an HTML document as a string.

Live Output


JavaScript Snippet

fetch('users.html').then(function(response) {
  return response.text();
}).then(function(body) {
  ChromeSamples.log(body);
});