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.


Triggers the installation of an app. During the installation process, the app is validated and the user is prompted to approve the installation.

If the app has previously been installed from the same domain, calling install() again may silently overwrite the existing install data. This can be used to modify the purchase receipt, for example, when a user upgrades from a free app to a premium app.


<code>var request = window.navigator.mozApps.install(url, [receipt1, …])</code>;


Note: There is currently (May 2012) a bug with passing a relative path in the url parameter. See bug 745928.
A string URL containing the location of the manifest to be installed. In the case of self distribution (where the installing origin is the same as the app origin), the installing site may omit the origin part of the URL and provide an absolute path (beginning with /).
(Optional) An array of one or more receipts. Example:
window.navigator.mozApps.install(url, ["receipt"])
If receipts is omitted it is treated as null. For more information see Validating a receipt.

The install() function throws an exception if the required argument (url) is missing, or if unsupported arguments are present.

Return value

The install() function returns a DOMRequest object. The DOMRequest.result field contains a DOMApplication object, which is a JavaScript object that describes the app that was just installed. Before the operation is finished, DOMRequest.result is null.

If the installation is not successful, DOMRequest.error contains a DOMError object, which has information about the error.


When the installation is unsuccessful, one of the following errors can be returned in DOMRequest.error.

The user cancelled the installation.
The manifest, while well-formed JSON, does not have some required field or is somehow invalid.
Something other than an HTTP 200 status code was received, or some connection errors.
Bad JSON in the manifest.
Connection error.
Reinstalls of apps are forbidden.
Prior to Gecko 34 (Firefox OS before 2.2, Firefox Desktop/Android before 34), installable apps have a "single app per origin" security policy; basically, you can't host more than one installable app per origin.


An example that shows how to use install() with the DOMRequest.onsuccess and DOMRequest.onerror callback properties.

var request = window.navigator.mozApps.install(manifestUrl);
request.onsuccess = function () {
  // Save the App object that is returned
  var appRecord = this.result;
  alert('Installation successful!');
request.onerror = function () {
  // Display the error information from the DOMError object
  alert('Install failed, error: ' +;

The onsuccess callback is called if the installation is successful. This means that the installation actions described here have occurred.

If the installation is not successful the onerror callback is called. On a failed installation, DOMRequest.error contains a DOMError object that has information about the error.

The code above may look unusual to you, with listeners being added after the function has already been invoked. However, this is the way the DOMRequest object operates. The function invocation will wait until the listeners are defined, and then the listeners will fire appropriately. The install() function also works by itself, without the .onsuccess and .onerror listeners.


© 2016 Mozilla Contributors
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.

API Apps Apps API Method