Button.onclick

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 property represents the function executed when the button is clicked.

Example:

The below example opens a new tab when the extension's button is clicked.

//
// The background process (e.g. index.html)
//

// Set the button's properties
var properties = {
  disabled: false,
  title: "My Extension",
  icon: "images/icon_18.png",
  onclick: function() {
    var tab = opera.extension.tabs.create();
  }
};

// Create and add the button to the toolbar
var button = opera.contexts.toolbar.createItem(properties);
opera.contexts.toolbar.addItem(button);
// // The background process (e.g. index.html) // // Set the button's properties var properties = { disabled: false, title: // // The background process (e.g. index.html) // // Set the button's properties var properties = { disabled: false, title:

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

Comments

  • photo

    Khursheed Fateh

    Friday, February 15, 2013

    I think last two lines need some corrections.
No new comments accepted.