Is it possible to use Electron in web application

2019-08-02 16:38发布

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条回答
狗以群分
2楼-- · 2019-08-02 17:06

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

查看更多
登录 后发表回答