Simple Script To See If CORS Is Allowed

The following is a simple HTML/JavaScript page that will tell you if a site allows cross origin resource sharing. Simple change the 'URL' section of the script to the API you want to test and then place this html file on a webserver. Works fine from on a local machine.

<html> used to check to see if CORS is allowed or not.

<script> console.log('hello'); var f = fetch('', { method: 'get' }).then(function(r) { return r.json(); }).then(function(r) { console.log(r); }).catch(function(e) { console.log(e); }) </script> </html>

If you get an error in the console then CORS is not allowed.