Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error "Not allowed to load local resource: file://sharedpath" [duplicate]

The below code is not working when running on server(nodejs) in chrome

<span><a href="file://sharedpath" target="_blank">Open folder.</a></span>

I am getting the following error message in the developer tool:

Not allowed to load local resource: file://sharedpath

But when opening the same path(file://sharedpath) in the browser(new tab), I am able to see the folder structure of that path. The same is working fine in IE. Is this a problem with Chrome? Or is this a problem when running on the server? Can anyone suggest something on this issue?

like image 593
Anudeep Kota Avatar asked Sep 10 '15 18:09

Anudeep Kota


2 Answers

Make sure that your host is fully qualified: Source

Try adding an additional slash: file:///sharedpath

See this answer

Specifically:

Some browsers, like modern versions of Chrome, will even refuse to cross from the http protocol to the file protocol, so you'd better make sure you open this locally using the file protocol if you want to do this stuff at all.

like image 154
Justin Avatar answered Oct 13 '22 00:10

Justin


Not sure what your whole context here is, but I used the web server extension for chrome for something similar when testing a local-build of something I'd eventually deploy (but wasn't ready to yet), and it worked great.

Just go to the extension url: https://chrome.google.com/webstore/detail/web-server-for-chrome/ofhbbkphhbklhfoeikjpcbhemlocgigb

Add the extension, enable it, and point it to the folder that contains the local file that you're having trouble with, and it should work correctly.

Hope that helps!

like image 27
sophistikaty Avatar answered Oct 13 '22 01:10

sophistikaty