#Can Electron "tell" its page that it is not running locally?

14 messages · Page 1 of 1 (latest)

vital lance
#

hm

#

I was about to ask what do you mean

plucky yarrow
#

sorry for deleting

#

I think it is all about webSecurity: false

vital lance
#

well, it's better not to disable it

plucky yarrow
#

for example, I have a three.js game, that fully client-side, but can't run locally because of some security restrictions about webgl canvas

vital lance
#

what kind of error do you get?

plucky yarrow
#

I don't remember now.
The idea is to have the static web page inside the electron appear exactly the same as in a browser window. At first I thought this was a trivial task.

vital lance
#

your packaged app load a local file?

plucky yarrow
#

Like if I had index.html, style.css and script.js and host it locally via npm http-server

plucky yarrow
vital lance
#

I know webSecurity can be annoying in dev because it will block some local resources when working with localhost, but it's not a problem in prod because everything is local, so webSecurity can be disabled in dev and enabled in prod and it works fine

#

I don't know if it's the same with webgl though

plucky yarrow
#

I'm not sure disabling webSecurity will be enough. It is more like I need to host web-page at 127.0.0.1 and open it via Electron's browser view.