diff options
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; |
