Cross-origin request for local file

User4870 picture User4870 · Apr 19, 2017 · Viewed 23.3k times · Source

I need to open a local html file in the browser. The javascript works fine but ajax stops working and XMLHttpRequest gives a cross origin error. Is there a way to run ajax from local directory. It is necessary for me that it is run from local file only.

Thanks

Answer

User4870 picture User4870 · Jan 28, 2018

For anyone who wants to know, I had to run a server in the app to serve the js files. Seems like it's not possible to do it without running a server. If anyone knows of another way, do tell.