Is it possible to use Electron in web application loaded from external web server?

半腔热情 提交于 2019-12-11 06:11:51

问题


I started to learn Electron and have one question:
Is it possible to use Electron's code in a web application only in the case when application was loaded by Electron from local folder?

win.loadURL('file://' + __dirname + '/app/index.html');

Is it not possible to use electron in web application's java script files if application was loaded to BrowserWindow from external web server?

win.loadURL('http://localhost:9000');

回答1:


You can use webview to load external web content.

It is similar to iframe with the difference that it runs in a seperate process than your app and it doesn't have the same permissions as your app, to keep your app safe from the embedded content.

More about the webview can be found here



来源:https://stackoverflow.com/questions/38375011/is-it-possible-to-use-electron-in-web-application-loaded-from-external-web-serve

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!