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

99,873

Solution 1

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.

Solution 2

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!

Share:
99,873
Anudeep Kota
Author by

Anudeep Kota

Updated on July 31, 2022

Comments

  • Anudeep Kota
    Anudeep Kota almost 2 years

    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?