Contents
chrome.extension API reference
Methods
connect
Attempts to connect to other listeners within the extension (listeners may be toolstrips or the extension's background page). This is primarily useful for content scripts connecting to their extension processes. Extensions may connect to content scripts embedded in tabs via chrome.tabs.connectToTab.
Parameters
- name ( optional string )
- Will be passed into onConnect for extension processes that are listening for the connection event.
Returns
- name ( Port )
- Port through which messages can be sent and received with the extension.
getViews
Returns an array of the global JavaScript objects for each of the views running inside the current extension. This includes toolstrips, background pages, and tabs.
Parameters
Returns
- name ( array of object )
- Array of global objects
getBackgroundPage
Returns the global JavaScript object for the background page running inside the current extension. Returns null if the extension has no backround page.
Parameters
Returns
- name ( object )
- Undocumented.
getToolstrips
Returns an array of the global JavaScript objects for each of the toolstrip views running inside the current extension. If windowId is specified, returns only the toolstrips attached to the specified window.
Parameters
- windowId ( optional integer )
- Undocumented.
Returns
- name ( array of object )
- Array of global objects
getTabContentses
Returns an array of the global JavaScript objects for each of the tab contents views running inside the current extension. If windowId is specified, returns only the tab contentses attached to the specified window.
Parameters
- windowId ( optional integer )
- Undocumented.
Returns
- name ( array of object )
- Array of global objects
Events
onConnect
Fired when a connection is made from either an extension process or a content script.
Parameters
- port ( Port )
- Undocumented.