Skip to content

Instantly share code, notes, and snippets.

@MahdiF
Created January 16, 2016 18:27
Show Gist options
  • Save MahdiF/9f96d51d7e67db84a114 to your computer and use it in GitHub Desktop.
Save MahdiF/9f96d51d7e67db84a114 to your computer and use it in GitHub Desktop.
checkShit = function(url) {
var request = new XMLHttpRequest();
request.open('HEAD', url, true);
request.onload = function() {
if (request.status >= 200 && request.status < 400) {
console.log('it\'s there');
} else {
console.log('it\'s not there');
}
};
request.send();
}
checkShit('folder/file.ext');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment