Skip to content

Instantly share code, notes, and snippets.

@nmalkin
Created February 21, 2016 05:11
Show Gist options
  • Save nmalkin/434688caa9209fbb1b14 to your computer and use it in GitHub Desktop.
Save nmalkin/434688caa9209fbb1b14 to your computer and use it in GitHub Desktop.
CORS request example
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8'>
</head>
<body>
<script>
var xhr = new XMLHttpRequest();
xhr.open('GET', 'https://archive.mozilla.org/pub/mobile/nightly/latest-mozilla-central-android-api-15/');
xhr.onload = function() {
document.write(xhr.responseText);
};
xhr.onerror = function(e) {
console.log('error!');
console.log(e)
};
xhr.send();
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment