不须要下载文件,就能够判断文件存在不存在

/*** 向指定门路发送下载申请* @param{String} url 申请门路*/function downLoadByUrl(url){        var xhr = new XMLHttpRequest();        //GET申请,申请门路url,async(是否异步)        xhr.open('GET', url, true);        //设置响应类型为 blob        xhr.responseType = 'blob';        xhr.onreadystatechange = function(){            console.log("筹备好:1",xhr.readyState)            console.log("筹备好:2",xhr.status)            if(xhr.readyState==3 && xhr.status==200){                console.log("文件存在");                //完结接管流,不再接管 要害操作                xhr.abort();            }            if(xhr.readyState==3 && xhr.status==404){                console.log("文件不存在");            }        }            //发送申请        xhr.send();}