Over in this firefox-dev thread
<
https://groups.google.com/forum/#%21topic/firefox-dev/WV2XkVN3sWQ>, I
decided to disable the desktop and Android web runtimes (WebRT)
<
https://wiki.mozilla.org/Apps/WebRT> for Open Web Apps
<
https://developer.mozilla.org/en-US/Apps>. After they're disabled, what
are the best alternatives for running web apps with native capabilities
on desktop and Android?
There are a variety of promising options, and I'm not an expert in any
of them, but I've listed them below along with my thoughts on which ones
would work best for various use cases. Did I miss anything or get
anything wrong? Please clarify and/or correct it!
Progressive Web Apps
Progressive Web Apps are web apps that use existing and emerging web
capabilities to obtain a compelling and competitive set of
characteristics, including network independence (i.e. they work
offline), push notifications, and native affordances like high-quality
homescreen icons and permanent fullscreen mode. Like Ajax
<
https://en.wikipedia.org/wiki/Ajax_%28programming%29>, responsive web
design <
https://en.wikipedia.org/wiki/Responsive_web_design>, and
Offline First! <
http://offlinefirst.org/>, Progressive Web Apps
represent a way of developing apps rather than a specific product for
doing so.
Alex Russell's blog post Progressive Web Apps: Escaping Tabs Without
Losing Our Soul
<
https://infrequently.org/2015/06/progressive-apps-escaping-tabs-without-losing-our-soul/>
is a kind of manifesto for these apps, and this route is the most like
traditional web app development and distribution, since it uses only
standard (albeit non-universal) APIs and decentralized distribution from
any web server to any web browser. It also has the benefit of being able
to gracefully degrade on older browsers.
Some "progressive" capabilities require an SSL-enabled server, however.
And this route doesn't enable you to access privileged Web APIs
<
https://developer.mozilla.org/en-US/docs/WebAPI> available to Open Web
Apps. The enabling technologies also aren't fully implemented in all
major browsers, and some (particularly Safari) haven't implemented key
technologies like Service Workers at all.
It seems best for apps that don't require privileged APIs, such as
hosted apps
<
https://developer.mozilla.org/en-US/Marketplace/Options/Hosted_apps>,
plus unprivileged packaged apps
<
https://developer.mozilla.org/en-US/Marketplace/Options/Packaged_apps>
(that use packaging for its ergonomics, to gain network independence, or
for another reason unrelated to privileged API access).
Apache Cordova
Cordova <
https://cordova.apache.org/docs/en/latest/guide/overview/> is a
framework for developing mobile apps using web technologies for a
variety of mobile platforms, including Android. It provides native API
bindings, so you can access capabilities like the ones provided by
privileged Web APIs. And it includes tools for packaging apps, which you
then distribute via mobile app stores or other distribution channels.
Cordova's Platform Support page
<
https://cordova.apache.org/docs/en/latest/guide/support/index.html>
does claim support for Windows and Ubuntu, but it isn't clear how well
supported the desktop variants of those OSes are. Cordova also renders
web apps via platform-specific WebView components rather than the Gecko
rendering engine in the web runtimes. (There's been some work to
integrate GeckoView into Cordova, and bug CB-6246
<
https://issues.apache.org/jira/browse/CB-3990> suggests that it was
implemented, but it isn't clear how well-supported it is.)
It seems best for apps that want to target Android (and other mobile
OSes) and need access to native APIs.
Electron and NW.js
Electron <
http://electron.atom.io/> and NW.js <
http://nwjs.io/> are
frameworks for developing desktop apps using web technologies. Like
Cordova, they provide native API bindings and include tools for
packaging apps, which you then distribute via desktop app stores or
other distribution channels.
Both of them embed Chromium, the web rendering engine in Chrome. And
they both support the same desktop platforms as the runtime (Windows,
Mac, and Linux). As with Cordova, Electron and NW.js seem best for apps
that need access to native APIs.
Finally, in the interest of being thorough, here are a few more options
that don't seem particularly promising. But as I mentioned earlier, I'm
not an expert on any of these, so I welcome corrections and clarifications!
XULRunner
XULRunner
<
https://developer.mozilla.org/en-US/docs/Mozilla/Projects/XULRunner> is
a runtime for desktop apps that are written in XUL
<
https://developer.mozilla.org/en-US/docs/Mozilla/Tech/XUL> (plus web
technologies like JavaScript and CSS), although it can also be used
(perhaps with a XUL shim) to run apps written in HTML. XULRunner embeds
Gecko, and Firefox includes a copy of XULRunner, so apps can reuse it
from a Firefox installation instead of bundling their own instance (in
fact the desktop web runtime does this).
But XULRunner is not a priority of the Mozilla organization, as noted in
this dev-platform thread
<
https://groups.google.com/forum/#%21searchin/mozilla.dev.platform/xulrunner/mozilla.dev.platform/_rFMunG2Bgw/C-4PcHj9IgAJ>.
And I'm not aware of any other organization that is committed to
maintaining and enhancing it, nor a significant community of active
contributors. Thus it suffers from the same viability problem as the web
runtimes.
GeckoView
GeckoView <
https://wiki.mozilla.org/Mobile/Projects/GeckoView> is a
component for Android that can be used to embed Gecko into your Android
app. It's roughly equivalent to the Android WebView component, although
doesn't try to maintain strict API compatibility with that component.
But GeckoView is called a "side project" in various descriptions of it,
like its introductory blog post
<
http://starkravingfinkle.org/blog/2013/10/geckoview-embedding-gecko-in-your-android-application/>
and this post about embedding it into a Gradle-based application
<
http://www.ncalexander.net/blog/2014/07/10/build-your-own-browser-a-maven-repository-for-geckoview/>.
And it isn't clear how useful it is for developing web apps
specifically, as opposed to native Android apps that need to render some
web content.
Graphene
Graphene, part of Browser.html
<
https://github.com/mozilla/browser.html>, is a version of Gecko (and
Servo <
https://servo.org/>) for developing desktop apps with web
technologies. It's somewhat analogous to Electron, except that it isn't
clear to what extent it provides native API bindings and tooling (versus
just the rendering engine). It was developed to support Browser.html,
and the new Brave browser <
https://github.com/brave/browser-laptop>
initially used it too (although now it uses Electron).
But Browser.html (and by extension Graphene) is an experimental research
project, not a supported product.
-myk