桌面上可执行的 HTML/Javascript 应用程序?
我想知道是否有一种方法可以创建一个本质上是浏览器的桌面应用程序,除了它只运行我的应用程序,不需要安装,并且是一个静态可执行文件,其中包含打包到的 HTML/图像/CSS/JavaScript它可以选择通过 JavaScript 访问任意嵌入资源吗?
我相信 Mozilla/Firefox 通过其 XUL 框架允许这样做,该框架实际上用于应用程序(请参阅 Celtx)。然而,我上次研究它时(大约三年前),这是一次可怕的经历,而且过于复杂。
这有改变吗?或者有基于 WebKit 的选项吗?
I'm wondering if there is a way to create a Desktop Application that is essentially a Browser, except that it only runs my Application, doesn't need installation and is a static executable that contains the HTML/Images/CSS/JavaScript packaged into it, with an option to access arbitary embedded resources through JavaScript?
I believe Mozilla/Firefox allows this through their XUL Framework, which is actually used for Applications (see Celtx). However, the last time I looked into it (~3 years ago), it was a horrible experience and overly complicated.
Has this changed? Or is there a WebKit based option?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
您应该尝试 Chromeless。
You should try Chromeless.
Chrome 支持
.crx
文件,这些文件本质上是一个 zip 文件,其中包含存档的资源。从技术上讲,它不需要安装,因为它在 Chrome 浏览器本身上运行。我知道这与你的问题没有直接关系,但我认为使用 HTML5、CSS3 和 JavaScript 构建 Web 应用程序是正确的选择。 您甚至可以将其打包并像应用程序一样安装和甚至通过应用商店分发。
Chrome supports
.crx
files which is essentially a zip file with the resources archived into it. It doesn't technically require installation since it's run on the Chrome browser itself.I know it's not directly relevant to your question but I think building web apps with HTML5, CSS3 and JavaScript is the way to go. You can even package it and have it install like an app and distribute it via an app store even.
我最终选择了 XULRunner 。最新版本比我几年前看到的版本有了很大改进。
I went with XULRunner in the end. The latest version is much improved over the one I looked at several years ago.
您可以使用 NW.JS:
https://github.com/nwjs/nw.js
基本上,您将创建一个包含整个 html 应用程序的文件夹。在 Windows 上,只需添加 4 个文件(或更多,具体取决于您的需要):package.json、nw.exe、nw.pak 和 icudtl.dat。当您运行 nw.exe 时,您的应用程序将在支持 Node.js 的 Chrome 打包版本中启动。您可以直接从原始 html 使用节点命令访问文件系统。
缺点:NW 会给您的应用程序增加约 60MB 的内存开销。
You could use NW.JS:
https://github.com/nwjs/nw.js
Basically you create a folder with your entire html app. On Windows, just add 4 files (or more depending on your needs): package.json, nw.exe, nw.pak, and icudtl.dat. When you run nw.exe, your app will launch in a packaged version of chrome with node.js support. You can access the file system using node commands directly from your original html.
The drawbacks: NW adds ~60MB to your application and additional memory overhead.