Open web app architecture

The Open Web Apps project architecture consists of the following elements:

  • Web-server-based installation

  • Web runtime

  • Integrated supporting services

Web-server-based installation

Apps can be installed from the server that hosts them ("self-hosting") or from a store. Mozilla launched the Firefox Marketplace in a test mode for apps in 2012. Other third-party app stores are also possible using this architecture. Apps can be free or paid. Stores can support validation of purchases to ensure that apps are run only by users who purchased them. The Firefox Marketplace will support this.

The Firefox Marketplace will support these activities:

  • Developers can submit HTML5-based apps by giving the location of a manifest file.
  • Developers can set a price for apps.
  • Users can install apps that are linked to their account by a digital receipt.
  • Apps can validate the user's receipt at run time. This mechanism supports returns and limited-time purchases.

Web runtime

While apps can run in any modern browser, many users expect a "native" experience, even for Web-based apps. The software that provides this extra capability for Open Web Apps is called the Web runtime. Currently, certain pre-release versions of Firefox come with Web runtime capability, and you have to install one of these Firefox versions to get it. When you run an app, Firefox does not visibly run as a browser. It simply provides the Web runtime in the background.

A Web runtime:

  • Installs a launch icon in the native operating system.
  • Can verify and then launch an app from the native operating system in a frameless window.
  • Shows the app in the native environment as a typical running application (so that application switching and monitoring work as expected).
  • Integrates with device capabilities. The WebAPI project is progressing towards supporting these APIs directly in Gecko (the Firefox layout engine that contains the Web runtime).
  • Provides a seamless launch experience. When an app is launched, it can check that its receipt is valid (if the app uses a receipt).

A future released version of Firefox will incorporate a Web runtime. You can try it now (September 2012) by using Firefox Beta for Windows and Mac, and Firefox Aurora (pre-beta) for Android. It is also available in the Firefox OS.

Firefox and the Web runtime have the same User Agent string, so you cannot do UA sniffing to determine if your app is running in the Web runtime. If you want to detect this, see How can my app detect that it is in the Web runtime?

The programming interface to the Web runtime is the navigator.mozApps JavaScript API.

Displaying pages in the Web runtime

The behavior of the Web runtime in displaying pages is not exactly the same as a browser. Keep the following in mind when designing your app.

  • You can display any URL in the app. The origin of a link being opened is not a consideration, but remember that you can send your users to a site with no way to get back, other than closing the app and starting over. So you have to make sure they have a way to navigate.
  • Most links open in the app.
  • A click on <a target="_blank" href="..."> will open in the default browser, outside of the app.
  • A call to window.open(url) opens in the app.
  • A call to window.open(url, "_blank") also opens in the app (but this behavior might change).

Discontinued Web runtimes

An early Web runtime was available as a Firefox extension (Mozilla Labs App Runtime for Firefox), but it is now discontinued. An early Android Web runtime that used PhoneGap (also known as Soup) is also discontinued. An HTML5 JavaScript shim Web runtime that was formerly available has been deprecated.

Integrated supporting services

Mozilla provides services that work together to support the apps ecosystem.

Persona

The apps architecture integrates Persona in multiple ways:

  • Developers and users will log in to the marketplace site using Persona.
  • Receipts for purchases from the marketplace are tied to the purchaser's Persona identity.
  • Apps that implement Persona support can instantly sign in users.

App synchronization

Mozilla is implementing a cloud-based app synchronization service called Apps in the Cloud. This service can store all of the purchase receipts linked to a given BrowserID identity (including from non-Mozilla stores that implement BrowserID). It can also synchronize those receipts to all of a user's devices, allowing apps purchased on one device to be used on other devices without repurchasing.

Document Tags and Contributors

Tags: 
 Contributors to this page: chrisdavidmills, kohei.yoshino, Sheppy, markg, teoli, jswisher
 Last updated by: chrisdavidmills,