03-27-2012, 01:09 PM
May be this question is not in correct format,
03-27-2012, 01:18 PM
If the file is on the server then you can use AJAX. If it's on the user's local machine then I don't think you can do it other than how you said you don't want to use.
03-27-2012, 01:19 PM
req = new XMLHttpRequest;
req.open("HEAD", strURL, false);
return (req.status==404) ? false : true;
03-27-2012, 11:39 PM
Note that Davey's answer only works if the file is on the same server that the web page came from. And even then only if the file is accessible via HTTP (that is, not in some directory that the web server is disallowed access to). But yes, it's by far the easiest way to do this.
03-28-2012, 12:49 AM
one minor point of clarification:
in the case of local files, a code like the one posted will work.
IE doesn'y do status correctly, and there's also no 404s to contend with:
var req = new XMLHttpRequest;
req.open("GET", strURL, false);
return !! req.responseText;