davidanthoff / Electron.jl

Julia wrapper for Electron
Other
85 stars 19 forks source link

Not allowed to load local resource: file://main.html/ #70

Closed cove closed 4 years ago

cove commented 4 years ago

I tried the following but is there some setting I need to pass in to allow loading local files?

using Electron, URIParser
app = Application()
cd(@__DIR__)
win = Window(app, URI("file://main.html"))

I get the following error in the console: Not allowed to load local resource: file://main.html/

davidanthoff commented 4 years ago

I think you probably need an absolute path. In general, I would actually recommend to use a Path from the FilePaths.jl package in this situation:

using Electron, FilePaths

app = Application()
win = Window(app, join(@__PATH__, "main.html"))

I didn't try it, but I think that should work.

cove commented 4 years ago

that worked, thanks!

cojua8 commented 4 years ago

I think the solution is easier (but does the same): just add a third / in file://...

using Electron, URIParser
app = Application()
cd(@__DIR__)
win = Window(app, URI("file:///main.html"))
davidanthoff commented 4 years ago

I think that is more a bug that this works... My understanding is that file: URIs need to be absolute.