chrome.webstore

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

Summary

Types
InstallStage
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"

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) {...};
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.

Events

onInstallStageChanged

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

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.