chrome.webstore

Description: Use the chrome.webstore API to initiate app and extension installations "inline" from your site.
Availability: Since Chrome 15.
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

Since Chrome 35.

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

Since Chrome 38.

Enum of the possible install results, including error codes sent back in the event that an inline installation has failed.
Enum
"otherError", "aborted", "installInProgress", "notPermitted", "invalidId", "webstoreRequestError", "invalidWebstoreResponse", "invalidManifest", "iconError", "userCanceled", "blacklisted", "missingDependencies", "requirementViolations", "blockedByPolicy", "launchFeatureDisabled", "launchUnsupportedExtensionType", or "launchInProgress"

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.