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.
Contents
How to Fix Cannot open local file – Chrome: Not allowed to load local resource Error?
- 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 typehttp-server ./
- 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
- OpenCV(4.1.2) error: (-215:Assertion failed) !ssize.empty() in function ‘cv::resize’
- OpenSSL Error messages: error:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed
- ESLint: Component definition is missing displayName (react/display-name)
- “IsADirectoryError: [Errno 21] Is a directory: It is a file”
- SyntaxError: import declarations may only appear at top level of a module