diff options
| author | caleb.mabry.15@cnu.edu <caleb.mabry.15@cnu.edu> | 2022-03-11 01:17:16 -0500 |
|---|---|---|
| committer | caleb.mabry.15@cnu.edu <caleb.mabry.15@cnu.edu> | 2022-03-11 01:17:16 -0500 |
| commit | 70f33fd0c1c931ca3859a7dce1a1272fd2863fbc (patch) | |
| tree | 1375b62b3877312031911372db990921486ed322 /webAO/utils | |
| parent | dc208478fd18a4e28c0083641bf405170859fc58 (diff) | |
Resolving issue 99
Diffstat (limited to 'webAO/utils')
| -rw-r--r-- | webAO/utils/fileExists.js | 17 |
1 files changed, 4 insertions, 13 deletions
diff --git a/webAO/utils/fileExists.js b/webAO/utils/fileExists.js index 261acda..6d32a1e 100644 --- a/webAO/utils/fileExists.js +++ b/webAO/utils/fileExists.js @@ -1,17 +1,8 @@ const fileExists = async (url) => { const xhr = new XMLHttpRequest(); - xhr.open('GET', url, true); - xhr.onload = function (e) { - if (xhr.readyState === 4) { - if (xhr.status === 200) { - return true; - } - return false; - } - }; - xhr.onerror = function (e) { - return false; - }; - xhr.send(null); + xhr.open('HEAD', url, false); + xhr.send(); + + return xhr.status === 200; }; export default fileExists; |
