opera.contexts.toolbar.length

By Opera Software

From Opera 15 onward, Opera 11 & 12’s extension format is no longer supported, and instead, we’ve switched to Chromium’s extension model. Check out our new documentation for developing extensions for Opera 15 and higher and start building your own extensions.

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;
}

This article is licensed under a Creative Commons Attribution 3.0 Unported license.

Comments

No new comments accepted.