close

[Fixed] Cannot open local file – Chrome: Not allowed to load local resource

Today We are Going To Solve Cannot open local file – Chrome: Not allowed to load local resource in Javascript. Here we will Discuss All Possible Solutions and How this error Occurs So let’s get started with this Article.

How to Fix Cannot open local file – Chrome: Not allowed to load local resource Error?

  1. How to Fix Cannot open local file – Chrome: Not allowed to load local resource Error?

    To Fix Cannot open local file – Chrome: Not allowed to load local resource Error just Install -g http-server. To solve this error first of all open your terminal and just type
    npm install -g http-server After it go to the root folder that you want to serve you files and type http-server ./

  2. Cannot open local file – Chrome: Not allowed to load local resource

    To Fix Cannot open local file – Chrome: Not allowed to load local resource Error just Start the Python Server. You have to go to file location and start the Python Server
    python -m SimpleHttpServer And after doing that put that url into function. And your error will be removed. Try it. function run(){ var URL = "http://172.271.1.20:8000/" window.open(URL, null); }

Solution 1 : Install -g http-server

To solve this error first of all open your terminal and just type

npm install -g http-server

After it go to the root folder that you want to serve you files and type http-server ./

Solution 2 : Start the Python Server

You have to go to file location and start the Python Server

python -m SimpleHttpServer

And after doing that put that url into function. And your error will be removed. Try it.

function run(){
var URL = "http://172.271.1.20:8000/" 
window.open(URL, null);
}

Conclusion

So these were all possible solutions to this error. I hope your error has been solved by this article. In the comments, tell us which solution worked? If you liked our article, please share it on your social media and comment on your suggestions. Thank you.

Also Read These Solutions

Leave a Comment