From 70f33fd0c1c931ca3859a7dce1a1272fd2863fbc Mon Sep 17 00:00:00 2001 From: "caleb.mabry.15@cnu.edu" Date: Fri, 11 Mar 2022 01:17:16 -0500 Subject: Resolving issue 99 --- webAO/utils/fileExists.js | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) (limited to 'webAO/utils') 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; -- cgit