opera.contexts.toolbar.length
Description
This attribute contains the number of UI items held by the ToolbarContext. Note: The ToolbarContext is currently restricted to a maximum of one UI item, so this will be either 1 or 0.
Example:
This attribute is useful for checking whether a button is being displayed in the toolbar or not.
//
// The background process (e.g. index.html)
//
// Is there a button in the toolbar?
if (opera.contexts.toolbar.length) {
var buttonExists = true;
} else {
var buttonExists = false;
}About this article
| Published in | Dev.Opera |
|---|---|
| Date | December 6, 2011 |
| Author | Opera Software |
| Tags | Button and Badge, extensions API, Toolbar |
| Original | Internet Archive |