Developers › Dev.Opera

opera.contexts.toolbar.length

December 6, 2011 · by Opera Software

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 inDev.Opera
DateDecember 6, 2011
AuthorOpera Software
TagsButton and Badge, extensions API, Toolbar
OriginalInternet Archive