Solved How to allow cross origin request for local files?
-
I would like to use Vivaldi to browse local files in addition to web sites.
Some of my local HTML files reference other local files, but Vivaldi will not render such pages due to CORS restrictions.
When I try to do so, the error messages in the console are:
Access to XMLHttpRequest at 'file://foo/bar/baz/index.html' from origin 'null' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https. foo/bar/baz/index.html: 1 Failed to load resource: net::ERR_FAILED
Can anyone tell me how might I get Vivaldi to allow cross origin requests for local files?
Thank you,
J Donald
Treeblossom Technologies -
I'm trying to go with the simplest approach with the fewest moving parts, so running a server - even a simple one - is not first choice.
The --allow-file-access-from-files flag worked.
Thank you!
J
-
@treeblossom Saw this and this on Stackoverflow. Looks like
file://
urls have issues with CORS.You should try setting up a local HTTP server. This is a really simple way if you have Python installed.
I have also used Flask in the past to run a local server on my network, but it is probably overkill if you are just doing something simple. I was able to access files from my Windows AppData folder with the Flask server, so it definitely works.
Edit: Here is another relevant stackoverflow with a startup flag you could try. But one of the replies states it could be dangerous and suggests running a local server as well. I am also not sure if the flag still works; I didn't test it.
-
I'm trying to go with the simplest approach with the fewest moving parts, so running a server - even a simple one - is not first choice.
The --allow-file-access-from-files flag worked.
Thank you!
J
-
Ppafflick moved this topic from Desktop on