mozilla
Your Search Results

    DOMApplicationsRegistry.checkInstalled()

    Non-standard
    This feature is non-standard and is not on a standards track. Do not use it on production sites facing the Web: it will not work for every user. There may also be large incompatibilities between implementations and the behavior may change in the future.

    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: teoli,