Framework for (HTML + JS) Desktop Client

2019-03-08 22:29发布

问题:

I plan to write a Desktop Client for Windows and Mac. It will be powered by web techniques (HTML + JS). Therefore it shall run on a WebKit engine on the user's desktop.

Recently, I saw an interesting approach for this issue: Appcelerator I love its basic concept, but I don't want be dependent on their services. Instead I want to have full control on the WebKit program, which loads my app.

Are there any decent open source WebKit frameworks for building desktop apps? Desktop integration features, such as Growl-support and stuff are appreciated.

Regards,

Stefan


Update: I'm not searching for Adobe Air ;-)

回答1:

Besides Appcelerator, I'm aware of two desktop gui frameworks that have a browser component that wraps webkit: GTK+ and Qt. You can make the browser component fill your application's window and write most (or all) of the application in HTML+CSS. If you like the Python language or it's very significant standard library, you can use the python bindings pyQt or pyGTK.

A more "beefy" alternative to Prism, if you're willing to go with the Gecko engine, is XULRunner (https://developer.mozilla.org/En/XULRunner). While Prism is a set of lightweight bindings to the desktop for a web app, XULRunner allows you to build a complete app like Firefox itself or Thunderbird, etc. While many XULRunner applications are written with XUL, it is easy to write the whole app using HTML/CSS inside a single XUL WebBrowser component - and your javascript still has all the power of a native desktop application.

I have written a couple desktop applications using XULRunner. Almost all of the applications' code is HTML/CSS/Javascript, but I have included the Python framework (via pyXPCOM and pyXPCOMext) and have written a thin layer that exposes some Python functionality to the Javascript. The Mozilla components that come with XULRunner gives you a decent amount of functionality for free, but if you find yourself in need of more functionality or a full-featured programming library, Python will do the trick. There are also bindings to Java. Or, if you want to use C or C++ libraries, you can build XULRunner from scratch.

Update: A few things have changed since I originally wrote the above in 2009. For one, the Prism project was dropped from Mozilla Labs and subsequently discontinued altogether in late 2011 (http://www.salsitasoft.com/2011/09/08/discontinuing-webrunner/). One alternative worth looking at is https://github.com/rogerwang/node-webkit.

Dec 2014 Update: Another recent option is GitHub's Atom Shell. It uses Chromium's "content" module, just like node-webkit and Chromium Embedded Framework (and publishes it as a standalone lib: https://github.com/brightray/libchromiumcontent). One major difference from node-webkit is that instead of merging node's event loop with Chromium's event loop, Atom launches them both in separate processes and uses a mixture of sync and async inter-process messages to communicate between them.

If you're interested in embedding Chromium in a C++ or .Net app, there's also Awesomium.



回答2:

The Appcelerator platform is open source, so you're not dependent on the company - you could always hack the code around yourself if you wanted. If you want more control you could always just hook directly into WebKit. The Gecko equivalent to AIR/Appcelerator Joel refers to is probably Mozilla Prism.



回答3:

If you're not absolutely committed to webkit, I recall something about a project to allow you do something similar with the Firefox engine. Basically a minimalist window around the gecko renderer plus Gears and desktop shortcut for your app. Can't find a link at the moment, though.