DOMApplicationsRegistry.checkInstalled()

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.

Summary

Gets information about the given app. This can be used to determine if the app is installed.

Syntax

var request = window.navigator.mozApps.checkInstalled(url);

Parameters

url
A string URL containing the location of the manifest of the app.

Return value

The checkInstalled() function returns a DOMRequest object. The DOMRequest.result property contains an App object, which is a JavaScript object that describes the installed app. If the app is not installed, then DOMRequest.result is null.

Errors

The string ERROR can be returned in DOMRequest.error.

An NS_ERROR_DOM_BAD_URI exception will be thrown if the manifest is in a different domain than the page requesting the information is. This will be thrown as soon as checkInstalled is invoked.

Example

var request = window.navigator.mozApps.checkInstalled("http://example.com/manifest.webapp");
request.onerror = function(e) {
  alert("Error calling checkInstalled: " + request.error.name);
};
request.onsuccess = function(e) {
  if (request.result) {
    console.log("App is installed!");
  }
  else {
    console.log("App is not installed!");
  }
};

Callers are expected to set the onsuccess and onerror callback properties of the returned object, as shown in this example. If the call is successful an App object is returned in the result property of the returned object. In the example this is request.result.

Document Tags and Contributors

 Last updated by: chrisdavidmills,