Skip to content

Instantly share code, notes, and snippets.

@gregglind
Created July 14, 2015 19:14
Show Gist options
  • Save gregglind/2da04930115fd03ffe93 to your computer and use it in GitHub Desktop.
Save gregglind/2da04930115fd03ffe93 to your computer and use it in GitHub Desktop.
var URL = "https://geo.mozilla.org/country.json";
var URL = "http://people.mozilla.org/~glind/";
var myHeaders = new Headers();
var myInit = { method: 'GET',
headers: myHeaders,
mode: 'cors',
cache: 'default' };
var myRequest = new Request(URL,myInit);
var ohno = function () { console.log.call(null, arguments)};
fetch(myRequest,myInit)
.then(function(response) {
console.log(response);
return response.blob();
}, ohno)
.then(function(myBlob) {
//var objectURL = URL.createObjectURL(myBlob);
//myImage.src = objectURL;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment