chrome.webstore

Description: Use the chrome.webstore API to initiate app and extension installations "inline" from your site.
Availability: Since Chrome 19.
Learn More: Using Inline Installation

Summary

Types
InstallStage
ErrorCode
Methods
install chrome.webstore.install(string url, function successCallback, function failureCallback)
Events
onInstallStageChanged
onDownloadProgress

Types

InstallStage

Enum used to indicate the stage of the installation process. 'downloading' indicates that the necessary files are being downloaded, and 'installing' indicates that the files are downloaded and are being actively installed.
Enum
"installing", or "downloading"

ErrorCode

Enum of the possible install results, including error codes sent back in the event that an inline installation has failed.
Enum
"otherError"
An uncommon, unrecognized, or unexpected error. In some cases, the readable error string can provide more information.
"aborted"
The operation was aborted as the requestor is no longer alive.
"installInProgress"
An installation of the same extension is in progress.
"notPermitted"
The installation is not permitted.
"invalidId"
Invalid Chrome Web Store item ID.
"webstoreRequestError"
Failed to retrieve extension metadata from the Web Store.
"invalidWebstoreResponse"
The extension metadata retrieved from the Web Store was invalid.
"invalidManifest"
An error occurred while parsing the extension manifest retrieved from the Web Store.
"iconError"
Failed to retrieve the extension's icon from the Web Store, or the icon was invalid.
"userCanceled"
The user canceled the operation.
"blacklisted"
The extension is blacklisted.
"missingDependencies"
Unsatisfied dependencies, such as shared modules.
"requirementViolations"
Unsatisfied requirements, such as webgl.
"blockedByPolicy"
The extension is blocked by management policies.
"launchFeatureDisabled"
The launch feature is not available.
"launchUnsupportedExtensionType"
The launch feature is not supported for the extension type.
"launchInProgress"
A launch of the same extension is in progress.

Methods

install

chrome.webstore.install(string url, function successCallback, function failureCallback)
Parameters
string (optional) url

If you have more than one <link> tag on your page with the chrome-webstore-item relation, you can choose which item you'd like to install by passing in its URL here. If it is omitted, then the first (or only) link will be used. An exception will be thrown if the passed in URL does not exist on the page.

function (optional) successCallback

This function is invoked when inline installation successfully completes (after the dialog is shown and the user agrees to add the item to Chrome). You may wish to use this to hide the user interface element that prompted the user to install the app or extension.

function (optional) failureCallback

This function is invoked when inline installation does not successfully complete. Possible reasons for this include the user canceling the dialog, the linked item not being found in the store, or the install being initiated from a non-verified site.

If you specify the failureCallback parameter, it should be a function that looks like this:

function(string error, ErrorCode errorCode) {...};
string error

The failure detail. You may wish to inspect or log this for debugging purposes, but you should not rely on specific strings being passed back.

ErrorCode (optional) errorCode

The error code from the stable set of possible errors.

Events

onInstallStageChanged

Since Chrome 35.

Fired when an inline installation enters a new InstallStage. In order to receive notifications about this event, listeners must be registered before the inline installation begins.

addListener

chrome.webstore.onInstallStageChanged.addListener(function callback)
Parameters
function callback

The callback parameter should be a function that looks like this:

function( InstallStage stage) {...};
InstallStage stage

The InstallStage that just began.

onDownloadProgress

Since Chrome 35.

Fired periodically with the download progress of an inline install. In order to receive notifications about this event, listeners must be registered before the inline installation begins.

addListener

chrome.webstore.onDownloadProgress.addListener(function callback)
Parameters
function callback

The callback parameter should be a function that looks like this:

function(double percentDownloaded) {...};
double percentDownloaded

The progress of the download, between 0 and 1. 0 indicates no progress; 1.0 indicates complete.