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?

Answers:

Answer

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.

Answer

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!

Tags

Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.