« Documentation Home


This documentation relates to Opera's now deprecated .oex Extension API framework for Opera versions <= 12.15 and also provided by our OEX2NEX shim library.

For the latest Opera Extensions API documentation for Opera versions > 12.15 please consult the latest Opera Extensions API documentation online.


The readonly selected attribute exposes the selected state of the browser tab. On getting, the selected attribute returns true if the browser tab is currently selected, otherwise, it returns false.


readonly boolean selected


The following example creates a button on the browser toolbar. When the button is clicked, the script loops through all open tabs and closes all tabs that are not currently selected.

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

// Specify the properties of the button before creating it.
var UIItemProperties = {
  disabled: false,
  title: "Example extension",
  icon: "images/icon_18.png",
  onclick: function() {
    // Get all tabs in the current window
    var tabs = opera.extension.tabs.getAll();
    // Loop through all the tabs
    for (var i = 0, len = tabs.length; i < len; i++) {
      // Close tabs that are not currently selected
      if (tabs[i].selected === false) {

// Create the button and add it to the toolbar.
var button = opera.contexts.toolbar.createItem( UIItemProperties );