I know this question has been asked multiple times and most of the answers are same using jQuery or XMLHttp object, etc. But the limitation using those methods is Access-Control-Allow-Origin.
I am looking to check whether a PDF file exists on the server or not before linking to it. If it does not exist I have to show an alert. I have tried XMLHTTP synchronous and asynchronous requests. But I get the below warning in Chrome:
Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience. For more help, check http://xhr.spec.whatwg.org/. http://fiddle.jshell.net/_display/ Failed to load resourceverify @ fiddle.jshell.net/:34
followed by:
Uncaught NetworkError: Failed to execute 'send' on 'XMLHttpRequest': Failed to load ...
For the latter, I get
XMLHttpRequest cannot load http://google.com/. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://fiddle.jshell.net' is therefore not allowed access.
I want to know if it is even possible using some workaround in Pure JS. I cannot use any other JavaScript libraries.