Google Chrome Extensions

chrome.scriptBadge

Warning: This API is still under development. It is only available to developers building from trunk. More info.

API Reference: chrome.scriptBadge

Methods

setPopup

chrome.scriptBadge.setPopup(object details)

Sets the html document to be opened as a popup when the user clicks on the script badge's icon.

Parameters

details ( object )
tabId ( integer )
The id of the tab for which you want to modify the script badge.
popup ( string )
The html file to show in a popup. If set to the empty string (''), no popup is shown.

getPopup

chrome.scriptBadge.getPopup(object details)

Gets the html document set as the popup for this script badge.

Parameters

details ( object )
tabId ( integer )
Specify the tab to get the popup from.

Callback function

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

function(string result) {...};
result ( string )

getAttention

chrome.scriptBadge.getAttention(object details)

Brings the script badge to the attention of the user, imploring her to click. You should call this when you detect that you can do something to a particular tab. Do not call this for every tab. That's tacky. If the user clicks on the badge, the activeTab APIs become available. If the extension has already run on this tab, this call does nothing.

Parameters

details ( object )
tabId ( integer )
Specify the tab to request to act on.

Events

onClicked

chrome.scriptBadge.onClicked.addListener(function(tabs.Tab tab) {...});

Fired when a script badge icon is clicked. This event will not fire if the script badge has a popup.

Listener Parameters

tab ( tabs.Tab )