是否可以在从外部Web服务器加载的Web应用程序中使用Electron? [英] Is it possible to use Electron in web application loaded from external web server?

查看:138
本文介绍了是否可以在从外部Web服务器加载的Web应用程序中使用Electron?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开始学习电子,并有一个问题:

是否有可能仅在Electron从本地文件夹加载应用程序的情况下,才在Web应用程序中使用Electron的代码?

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');

如果应用程序是从外部加载到BrowserWindow的,则无法在Web应用程序的Java脚本文件中使用电子网络服务器?

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');


推荐答案

这是绝对可能的。 BrowserWindow.loadUrl还将加载http位置(本地主机或其他位置)。

It is absolutely possible. BrowserWindow.loadUrl will also load an http location, localhost or otherwise.

我们使用它从本地webpack开发服务器加载应用程序以刷新更改,而不必重启应用程序,更不用说重启应用程序了

We use this to load the application from a local webpack dev server to refresh with changes without having to restart the application let alone having to go through the entire build process.

在这里,您可以找到一个有关此的示例

Here you can find an example on exactly that

这篇关于是否可以在从外部Web服务器加载的Web应用程序中使用Electron?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆