I am using XMLHttpRequest’s in my webpage and I was wondering if this was actually possible due to the fact that my webpage works on a local host but using glitch, it throws a error.
Error:
Access to XMLHttpRequest at ‘discord webhook here’ from origin ‘https://agrwebhooks.glitch.me’ has been blocked by CORS policy: Response to preflight request doesn’t pass access control check: No ‘Access-Control-Allow-Origin’ header is present on the requested resource.
Yes, they are allowed but they can be tricky to use. You can always use “cors-anywhere” to fix this. Add https://cors-anywhere.herokuapp.com/ in front of your URLs.
Is it a static project or a node server? If it’s a node/express server you can directly disable the CORS policy. Otherwise, you will have to use some sort of proxy like what @RiversideRocks suggested when making the request. Best to give it a Google.