You are viewing extension docs in chrome via the 'file:' scheme: are you expecting to see local changes when you refresh? You'll need run chrome with --allow-file-access-from-files.
WARNING: This is the BETA documentation. It may not work with the stable release of Chrome.
WARNING: This is unofficial documentation. It may not work with the current release of Chrome.

Google Chrome Extensions (Labs)

chrome.runtime

Warning: This API is still under development. It is only available for Chrome users on the dev early release channel. Learn more.

API reference: chrome.runtime

Methods

getBackgroundPage

chrome.runtime.getBackgroundPage(function callback)

Retrieves the JavaScript 'window' object for the background page running inside the current extension. If the background page is transient, the system will ensure it is loaded before calling the callback. If there is no background page, an error is set.

Parameters

callback
( function )
Undocumented.

Callback function

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

function(global backgroundPage) {...};
backgroundPage
( optional global )
The JavaScript 'window' object for the background page.

Events

onBackgroundPageUnloadingSoon

chrome.runtime.onBackgroundPageUnloadingSoon.addListener(function() {...});

Sent to the transient background page just before it is unloaded. This gives the extension opportunity to do some clean up. Note that since the page is unloading, any asynchronous operations started while handling this event are not guaranteed to complete.

onInstalled

chrome.runtime.onInstalled.addListener(function() {...});

Fired when the extension is first installed.