I've made a fairly rudimentary url response checker that lets me know if a list of urls is responding 200, 404, 500 or one of the 30x redirects. It's working ok, but in the latter case I'm coming up against the CORS policy "Access-Control-Header" error in the console, and the script then disregards these responses because they're not one of the above. I'm not sure how to get the script to pick up on these, as my knowledge of jquery and the ajax statusCode function is fairly limited.
The main snippet of code I'm using is as follows:
$.ajax({
type: "GET",
url: urlToTest,
statusCode: {
200: function() {
//do something
},
404: function(){
//do something
},
etc, with options for 500 and the 8 different 30x redirects.
The error I receive in the console is:
"XMLHttpRequest cannot load . Redirect from '' to '' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin '' is therefore not allowed access.