javascript 将 WebKit 用于桌面应用程序
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/9618678/
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
Using WebKit for a desktop application
提问by Luca Matteis
I need to make a desktop application using CSS/HTML5/JavaScript. This application should work cross-platform (Linux/Mac/Windows) and will be distributed as a simple executable (not an installer), where the user simply opens it and can start using it right away. It also needs to work offline, on machines where internet is not accessible.
我需要使用 CSS/HTML5/JavaScript 制作桌面应用程序。此应用程序应跨平台(Linux/Mac/Windows)运行,并将作为简单的可执行文件(不是安装程序)分发,用户只需打开它即可立即开始使用。它还需要在无法访问互联网的机器上离线工作。
So I thought WebKit would be the perfect choice. In fact I went ahead, installed Xcode, and in little time I had an executable that opened a window and loaded some CSS/HTML/JavaScript.
所以我认为 WebKit 将是完美的选择。事实上,我继续前进,安装了 Xcode,很快我就有了一个可执行文件,可以打开一个窗口并加载一些 CSS/HTML/JavaScript。
However, my issue is that I don't have Linux/Windows machines. I can't afford buying a Windows copy and I don't want to go through the effort of having to install the OS and installing the Visual Studio or whatever thing, and trying to make an executable for those platforms as well.
但是,我的问题是我没有 Linux/Windows 机器。我买不起 Windows 副本,我不想经历必须安装操作系统和安装 Visual Studio 或其他任何东西的努力,也不想为这些平台制作可执行文件。
I was wondering if there was a pre-built executable for each platform that comes with WebKit. So that all I have to do is change the icon of the application, the name and tell it where to get the html/css/javascript and it would make an executable for the platforms I need.
我想知道是否有针对 WebKit 附带的每个平台的预构建可执行文件。所以我所要做的就是更改应用程序的图标、名称并告诉它从哪里获取 html/css/javascript,它会为我需要的平台制作一个可执行文件。
Is this possible? What are my best alternatives?
这可能吗?我最好的选择是什么?
采纳答案by Matthieu Napoli
You can use node-webkit.
您可以使用node-webkit。
It uses webkit to render the webpage and execute the Javascript, and you will have access to all the Node.js javascript API (reading/writing files, …)
它使用 webkit 来呈现网页并执行 Javascript,您将可以访问所有 Node.js javascript API(读取/写入文件,...)
回答by burak altundal
Update: Titanium Desktop is an open sourced project nowadays and named "TideSDK"
更新:Titanium Desktop 现在是一个开源项目,名为“TideSDK”
You may try both of below. I have used Titanium Desktop: It is webkit based and also becoming an open source project.
您可以尝试以下两种方法。我用过 Titanium Desktop:它是基于 webkit 的,也成为了一个开源项目。
http://www.appcelerator.com/products/titanium-desktop-application-development/
http://www.appcelerator.com/products/titanium-desktop-application-development/
You can also use Embedded Chromium project, but this might require some knowledge on other then HTML/CSS/JS
你也可以使用 Embedded Chromium 项目,但这可能需要一些 HTML/CSS/JS 以外的知识
回答by Skylar Saveland
There is certainly some way to do this with Qt / QtWebkit/ QWebview. But, it is certainly involved.
使用 Qt / QtWebkit/ QWebview肯定有一些方法可以做到这一点。但是,它肯定涉及。
There is also a Gtk Webkit.
还有一个Gtk Webkit。
回答by Keenan
You would still need an installer, but you can look into Adobe Air. You can build apps that even leverage AS3 libraries as well as make them entirely with HTML5/CSS3 and your flavor of Javascript. Best of luck to you.
您仍然需要安装程序,但您可以查看 Adobe Air。您可以构建甚至利用 AS3 库的应用程序,也可以完全使用 HTML5/CSS3 和您的 Javascript 风格来制作它们。祝你好运。