03-27-2012, 12:09 PM
May be this question is not in correct format,
03-27-2012, 12: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, 12:19 PM
req = new XMLHttpRequest;
req.open("HEAD", strURL, false);
return (req.status==404) ? false : true;
03-27-2012, 10: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-27-2012, 11:49 PM
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;
Powered by vBulletin® Version 4.2.2 Copyright © 2017 vBulletin Solutions, Inc. All rights reserved.