ghcjs / jsaddle

JavaScript interface that works with GHCJS or GHC
116 stars 62 forks source link

jsaddle-webkit2gtk: "Not allowed to load local resource" #91

Open autc04 opened 5 years ago

autc04 commented 5 years ago

I'm trying to include a javascript+css widget library from a reflex-dom app compiled with native jsaddle-webkit2gtk. WebKit refuses:

file:///XXX/index.html:247:76: CONSOLE ERROR Not allowed to load local resource: file:///XXX/node_modules/onsenui/css/onsenui.css
file:///XXX/index.html:247:76: CONSOLE ERROR Not allowed to load local resource: file:///XXX/node_modules/onsenui/css/onsen-css-components.css
file:///XXX/index.html:247:76: CONSOLE ERROR Not allowed to load local resource: file:///XXX/style.css
file:///XXX/index.html:247:76: CONSOLE ERROR Not allowed to load local resource: file:///XXX/node_modules/onsenui/js/onsenui.js

The files are referenced via relative path URLs from my app.

Should a native app refuse to access file URLs? Is there a different way for loading resources in a native app?

autc04 commented 5 years ago

Update: if the current directory at program startup contains an index.html file, the above does not occur. An empty file seems to suffice.

aidatorajiro commented 4 years ago

Additional comment: If the resource is placed outside the executable's directory, the resource cannot be loaded due to "kCFErrorDomainCFNetwork" error. (jsaddle-0.9.7.0 , Mac OS 10.14.6)

ibizaman commented 3 years ago

This could be a CORS issue. See https://stackoverflow.com/questions/8456538/origin-null-is-not-allowed-by-access-control-allow-origin and https://stackoverflow.com/a/37690646/1013628 for some suggestions on how to workaround the issue.