Javascript 将 HTML5 应用程序作为桌面应用程序分发的解决方案?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/4869613/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Solutions for distributing HTML5 applications as desktop applications?
提问by foreyez
What are some solutions for distributing an HTML5 based desktop application?
分发基于 HTML5 的桌面应用程序有哪些解决方案?
I want to be able to distribute my HTML5 app as a standalone desktop application on Windows, OSX, and Linux. I would like for people to be able to double click my app icon shortcut to run my program.
我希望能够在 Windows、OSX 和 Linux 上将我的 HTML5 应用程序作为独立的桌面应用程序分发。我希望人们能够双击我的应用程序图标快捷方式来运行我的程序。
I don't want the browser window showing at all, just my app. Is this possible?
我根本不想显示浏览器窗口,只显示我的应用程序。这可能吗?
回答by Samuel Herzog
HTML5 Apps in 2014
2014 年的 HTML5 应用
Frames by chrome/webkit
框架由 chrome/webkit
Electron(former Atom Shell)
Electron is an open source library developed by GitHub for building cross-platform desktop applications with HTML, CSS, and JavaScript. Electron accomplishes this by combining Chromium and Node.js into a single runtime and apps can be packaged for Mac, Windows, and Linux. (source)
The folks at github use this to provide their code editor Atomas an app. It has an documented api and a help channel on the official atom forums.
Node-Webkit, the most minimal approach
node-webkit is an app runtime based on Chromium and node.js. You can write native apps in HTML and JavaScript with node-webkit. It also lets you call Node.js modules directly from the DOM and enables a new way of writing native applications with all Web technologies.
Intel is behind this (?). I've been told it's very rough around the edges.
Brackets Shell, the sandbox of Adobes code editor (and base of Adobe Edge)
Note: The brackets-shell is only maintained for use by the Brackets project. Although some people have definitely had success using it as an app shell for other projects, we don't provide any official support for that and we haven't done a ton of work to make the app shell easily reusable. Many people will likely find it easier to use a project like node-webkit, which is more generic by design.
says the readme, but there are quite a lot of folks out there who did it nevertheless.
电子(前原子壳)
Electron 是由 GitHub 开发的开源库,用于使用 HTML、CSS 和 JavaScript 构建跨平台桌面应用程序。Electron 通过将 Chromium 和 Node.js 组合到一个运行时中来实现这一点,并且可以为 Mac、Windows 和 Linux 打包应用程序。(来源)
github 上的人使用它来提供他们的代码编辑器 Atom作为一个应用程序。它在官方 atom 论坛上有一个文档化的 api 和一个帮助频道。
Node-Webkit,最小的方法
node-webkit 是一个基于 Chromium 和 node.js 的应用运行时。您可以使用 node-webkit 用 HTML 和 JavaScript 编写本机应用程序。它还允许您直接从 DOM 调用 Node.js 模块,并支持使用所有 Web 技术编写本机应用程序的新方法。
英特尔是这件事的幕后推手(?)。有人告诉我它的边缘非常粗糙。
Brackets Shell,Adobes 代码编辑器的沙箱(也是 Adobe Edge 的基础)
注意:括号外壳仅维护供 Brackets 项目使用。尽管有些人将它用作其他项目的应用程序外壳确实取得了成功,但我们不提供任何官方支持,也没有做大量工作来使应用程序外壳易于重用。许多人可能会发现使用像 node-webkit 这样的项目更容易,它的设计更通用。
自述文件说,但仍然有很多人这样做了。
Frameworks + Tools
框架 + 工具
Adobe AIR, as another answers suggested.
The Adobe? AIR? runtime enables developers to package the same code into native apps for Windows and Mac OS desktops as well as iPhone, iPad, Kindle Fire, Nook Tablet, and other Android? devices, reaching the mobile app stores for over 500 million devices.
Senchais a company which sells tools for app developers, including html5 app development and distribution.
Adobe AIR,正如另一个答案所建议的那样。
阿多吗?空气?运行时使开发人员能够将相同的代码打包到适用于 Windows 和 Mac OS 桌面以及 iPhone、iPad、Kindle Fire、Nook Tablet 和其他 Android? 设备,进入移动应用商店的设备超过 5 亿。
Sencha是一家为应用程序开发人员销售工具的公司,包括 html5 应用程序开发和分发。
Inactive approaches
不活跃的方法
Tide SDK(archived on 2015-07-12 at archive.org), beta version, discontinued on 12th Jul 2015
XULRunner from Mozillamay do the trick for you but adds some overhead.
app.jsended at 28th Oct 2013for being surpassed by (https://github.com/rogerwang/node-webkit)[node-webkit].
Because it is simple and yet powerful. Using AppJS you don't need to be worry about coding cross-platform or learning new languages and tools. You are already familiar with HTML, CSS and JavaScript. What is better than this stack for application development? Beside, AppJS uses Chromium at the core so you get latest HTML 5 APIs working. So and focus on the task your application should do.
Mozilla Prismis decomissioned, their slugline was:
Bringing web applications to your Desktop
Prism is an application that lets users split web applications out of their browser and run them directly on their desktop.
Tide SDK(存档于 2015-07-12 at archive.org),测试版,2015 年 7 月 12 日停产
Mozilla 的 XULRunner可能会为您解决问题,但会增加一些开销。
app.js于2013 年 10 月 28 日结束,因为被 ( https://github.com/rogerwang/node-webkit)[node-webkit]超越。
因为它简单而强大。使用 AppJS,您无需担心跨平台编码或学习新语言和工具。您已经熟悉 HTML、CSS 和 JavaScript。对于应用程序开发,有什么比这个堆栈更好的呢?此外,AppJS 以 Chromium 为核心,因此您可以使用最新的 HTML 5 API。因此,请专注于您的应用程序应该执行的任务。
Mozilla Prism已退役,他们的标语是:
将 Web 应用程序带入您的桌面
Prism 是一种应用程序,它允许用户将 Web 应用程序从浏览器中分离出来,并直接在他们的桌面上运行。
回答by Morteza Milani
You can use AppJS which uses Nodejs and Chromium to build html5 apps for desktop. check it out: http://appjs.comGithub Link: https://github.com/appjs/appjs
您可以使用 AppJS,它使用 Nodejs 和 Chromium 为桌面构建 html5 应用程序。看看:http://appjs.com Github 链接:https: //github.com/appjs/appjs
回答by Will Hartung
You might want to look at XULRunner from Mozilla. At a 10000 foot level, the FireFox browser is a XULRunner application (obviously a very sophisticated one, but...). But XULRunner lets you use Javascript and XML to create applications, and the browser window is one of those components, so you once you get your basic window up, you can likely do pretty much anything you want.
您可能想看看 Mozilla 的 XULRunner。在 10000 英尺的高度,FireFox 浏览器是一个 XULRunner 应用程序(显然是一个非常复杂的应用程序,但是……)。但是 XULRunner 允许您使用 Javascript 和 XML 来创建应用程序,而浏览器窗口就是这些组件之一,因此一旦您设置了基本窗口,您就可以做几乎任何您想做的事情。
Also, depending on the sophistication of your application, there are several "widget" frameworks (like Dashboard on the Mac, Yahoo Widgets, Windows Gadgets) which are basically HTML runtimes as well.
此外,根据您的应用程序的复杂程度,有几个“小部件”框架(如 Mac 上的仪表板、雅虎小部件、Windows 小工具),它们基本上也是 HTML 运行时。
回答by ggutenberg
Definitely check out Titanium. Just today I took a functional HTML5 app and with a few minor modifications was able to drop it into Titanium and package it up for Mac, Windows and Linux.
绝对检查钛。就在今天,我使用了一个功能强大的 HTML5 应用程序,经过一些小的修改,能够将它放入 Titanium 并将其打包为 Mac、Windows 和 Linux。
And it also supports PHP, Python and Ruby if your app requires "server-side" processing.
如果您的应用程序需要“服务器端”处理,它还支持 PHP、Python 和 Ruby。
回答by user822746
chrome can do what prism does See -- Tools-> Create application Shortcut
chrome 可以做prism 做的事 查看--工具-> 创建应用程序快捷方式
回答by Christian Kuetbach
You can try Phonegap, there is a Windows Desktop Port: https://github.com/davejohnson/phonegap-windows
你可以试试Phonegap,有一个Windows桌面端口:https: //github.com/davejohnson/phonegap-windows
I tried the mac-port, it worked well. I didn't try the windows version yet.
我尝试了 mac-port,效果很好。我还没有尝试 Windows 版本。
回答by Vik
[On Windows only] try HTML Application (HTA) approach - simply save your .html file with .hta extension. It also provides some additonal settings to get rid of browser window, set level of trust for the app, etc. Read more here: http://en.wikipedia.org/wiki/HTML_Applicationand here http://technet.microsoft.com/en-ca/scriptcenter/dd742317.aspx
[仅在 Windows 上] 尝试 HTML 应用程序 (HTA) 方法 - 只需使用 .hta 扩展名保存您的 .html 文件。它还提供了一些附加设置来摆脱浏览器窗口、设置应用程序的信任级别等。在此处阅读更多信息:http: //en.wikipedia.org/wiki/HTML_Application和此处http://technet.microsoft。 com/en-ca/scriptcenter/dd742317.aspx
回答by T.J. Crowder
回答by Jeff
Hmmm... a virtual machine for HTML5/CSS/JS... sounds like a browser. :)
嗯……HTML5/CSS/JS 的虚拟机……听起来像一个浏览器。:)
Maybe Adobe AIR would do the trick, because it's based on the idea of bringing rich Internet apps to the desktop. I've never used it, however.
也许 Adobe AIR 可以解决这个问题,因为它基于将丰富的 Internet 应用程序引入桌面的想法。不过我从来没用过。
One thing you could do is develop a very basic desktop app that uses some kind of prepackaged web browser control (e.g. if you're developing for a Mac, just drop a WebView in the window and add some basic code to load your html upon app startup).
您可以做的一件事是开发一个非常基本的桌面应用程序,它使用某种预先打包的 Web 浏览器控件(例如,如果您正在为 Mac 开发,只需在窗口中放置一个 WebView 并添加一些基本代码以在应用程序上加载您的 html启动)。
回答by Peacemoon
Check this new project from Mozilla. You can create desktop apps too : https://developer.mozilla.org/en/Apps
从 Mozilla 检查这个新项目。您也可以创建桌面应用程序:https: //developer.mozilla.org/en/Apps
Detail here: http://hacks.mozilla.org/2012/05/desktop-apps-with-html5-and-the-mozilla-web-runtime/
详情请见:http: //hacks.mozilla.org/2012/05/desktop-apps-with-html5-and-the-mozilla-web-runtime/