Answers for "XMLHttpRequest() check if file exists"

0

XMLHttpRequest() check if file exists

function UrlExists(url)
{
    if (window.XMLHttpRequest) { // code for IE7+, Firefox, Chrome, Opera, Safari
      var http=new XMLHttpRequest();
    } 
    else {
      var http=new ActiveXObject("Microsoft.XMLHTTP");
    }

    http.open('HEAD', url, false);
    http.send();
    return http.status!=404;
}
Posted by: Guest on March-11-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language