How to Run Microsoft Edge without CORS Restriction
A simple guide on how to start a Microsoft Edge web browser with CORS disabled for development and testing
As a web developer, you likely need to test your REST API locally. When using a browser like Microsoft Edge, you might encounter issues such as the following message.
Access to fetch at ‘http://localhost:8000/api’ from origin ‘http://localhost:3000’ has been blocked by CORS policy: No ‘Access-Control-Allow-Origin’ header is present on the requested resource. If an opaque response serves your needs, set the request’s mode to ’no-cors’ to fetch the resource with CORS disabled.
No need to worry—modern web browsers implement this as a solid security measure.
I won’t burden you with all the details about CORS, but you can check out the official documentation for more information. If you’re curious, here’s a summary from Wikipedia.
Cross-origin resource sharing (CORS) is a mechanism to safely bypass the Same-origin policy, that is, it allows a web page to access restricted resources from a server on a domain different than the domain that served the web page.
Here’s an example of a cross-origin request: front-end JavaScript code served from https://example.com/ uses fetch()
to request data from https://example.org/api/data.json.
Luckily, bypassing CORS restrictions in Microsoft Edge is simple. Just follow the appropriate guide for your current operating system.
How to Run Microsoft Edge without CORS on macOS
Launch your Terminal and enter the following command to open a new instance of Microsoft Edge without CORS.
How to Run Microsoft Edge without CORS on Windows 11
Windows offers two types of command-line interpreters: PowerShell and Command Prompt (cmd.exe). Personally, I like using Windows Terminal on modern Windows systems, as it defaults to PowerShell.
Here’s how to launch Microsoft Edge with CORS disabled using PowerShell.
If you’re still using the Command Prompt / cmd.exe, you can start Microsoft Edge without CORS with the following command. Notice that I just simply removed the dot as the first character.
Conclusion
That’s everything I can share. You can open a Microsoft Edge window with CORS disabled without affecting your primary Microsoft Edge user data.
Thanks for reading, and see you next time!