electrum-web icon indicating copy to clipboard operation
electrum-web copied to clipboard

website hard to test locally; it requires a webserver. (problem when using file URIs)

Open SomberNight opened this issue 4 years ago • 1 comments

The html files cannot be easily tested in a browser locally. The website is broken when using the file:// protocol; it works when using http://, so the workaround is to run a webserver locally.

Firefox (87.0) logs:

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at file:///.../electrum-web/panel-download.html. (Reason: CORS request not http).
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at file:///.../electrum-web/projects.json. (Reason: CORS request not http).

See https://developer.mozilla.org/en-US/docs/Archive/Misc_top_level/Same-origin_policy_for_file:_URIs

SomberNight avatar Mar 31 '21 17:03 SomberNight

self-note: quick way to set up a webserver for local testing:

$ cd "$WWW_DIR"
$ python3 -m http.server --bind localhost 9995
$ firefox localhost:9995

SomberNight avatar May 22 '23 00:05 SomberNight