App Installation and Management APIs

Marketplace feature removal
The functionality described on this page no longer works — Firefox Marketplace has discontinued support for Android, Desktop, Tablets, and payments (and other related functionality). For more information, read the Future of Marketplace FAQ.

The Open Web Apps JavaScript API is a programmatic interface for installing Web apps and for managing a client-side collection of Web apps that a user has installed. This collection is called the application repository.

Feature availability

The JavaScript API described here is available in Firefox OS.

Methods of the API

All methods related to apps are accessed from the navigator.mozApps object. There are two types of functions available in the API:

  • Installation Functions: related to the installation or management of installed apps. These are interesting to stores, self-distributing apps, and app directories.
  • Management Functions: related to the display, launch, or synchronization of apps. Primarily used by dashboards.

Installation API (navigator.mozApps.*)

The apps installation API is exposed as methods on the window.navigator.mozApps object.

Management API (navigator.mozApps.mgmt.*)

The apps management API is privileged. It is intended to grant access to trusted pages, also called "dashboards". The management API exposes functions that let dashboards manage and launch apps on a user's behalf. Additionally, the API exposes functions for app sync, which lets the dashboard display the logged-in state of the user and allows the user to sign up or register for an account to synchronize apps across devices.

Objects

These types of JavaScript objects are used by the apps API:

  • App objects represent apps.
  • DOMRequest objects monitor the progress, success, error, or result of an operation. They are returned by several methods.
  • DOMError objects represent errors returned by methods.

Old API and the new API

If you were using the older API, it is obsolete as of . The old API is compared with the new API below.

navigator.mozApps.install()
This function has a changed signature.
navigator.mozApps.amInstalled()
Replaced by navigator.mozApps.getSelf().
navigator.mozApps.getInstalledBy()
Replaced by navigator.mozApps.getInstalled().
navigator.mozApps.mgmt.list()
Replaced by navigator.mozApps.mgmt.getAll().
navigator.mozApps.mgmt.watchUpdates(onupdate)
navigator.mozApps.mgmt.clearWatch(watchId)
Both of these replaced by navigator.mozApps.oninstall and navigator.mozApps.onuninstall.
navigator.mozApps.mgmt.uninstall(origin, [onsuccess], [onerror])
Replaced by navigator.mozApps.mgmt.uninstall(app) where app is an object returned by getAll() or any other function handing app objects.