I tried using the two different methods included below. The first which exclusively uses JavaScript and the second method which uses jQuery. Both gave the same result which was that it worked fine in Firefox but failed at "http.send()" in both Chrome and Internet Explorer 11. Lastly I tried appending 'chrome.exe" --allow-file-access-from-files', but nothing works. Are Chrome and IE too secure to function? Any suggestions are welcome.
// This function checks to see if the file really exists and returns TRUE if it does.
function urlExists(url) {
var http = new XMLHttpRequest();
try {
http.open('HEAD', url, false);
http.send();
} catch (err) {
silenterror = err;
return false;
}
return http.status === 200;
}
// This function checks to see if the file really exists and returns TRUE if it does.
function urlExists(testUrl) {
var http = jQuery.ajax({
type : "HEAD", //Not get
url : testUrl,
async: false
});
return http.status === 200;
}