« Documentation Home

Windows & Tabs

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.

Windows

opera.extension.windows.create()
Creates a new browser window.
opera.extension.windows.getAll()
Obtains a group of windows (window collection).
opera.extension.windows.getLastFocused()
Obtains the currently selected browser window, if any.
BrowserWindow.insert()
Inserts a tab or tab group into a browser window.
BrowserWindow.close()
Closes a browser window.
BrowserWindow.focus()
Gives focus to a browser window.
BrowserWindow.update()
Updates the properties of a browser window.
BrowserWindow.id
A unique identifier for the browser window.
BrowserWindow.closed
Gets the closed state of the browser window.
BrowserWindow.focused
Gets and sets the focused state of the browser window.
BrowserWindow.parent
Gets the parent window, if any.
BrowserWindow.private
Gets and sets the private state of the browser window.
BrowserWindow.tabGroups
Gets a window tab group manager.
BrowserWindow.tabs
Gets a window tab manager.
BrowserWindow.height
Sets the height of a browser window.
BrowserWindow.width
Sets the width of a browser window.
BrowserWindow.top
Sets the top offset of a browser window.
BrowserWindow.left
Sets the left offset of a browser window.

opera.extension.tabGroups

opera.extension.tabGroups.create()
Creates a new tab group.
opera.extension.tabGroups.getAll()
Obtains a group of tab groups (tab group collection).
BrowserTabGroup.close()
Closes a tab group.
BrowserTabGroup.focus()
Gives focus to a tab group.
BrowserTabGroup.insert()
Inserts a tab into a tab group.
BrowserTabGroup.update()
Updates the properties of a tab group.
BrowserTabGroup.id
Gets a unique identifier for a tab group.
BrowserTabGroup.closed
Gets the closed state of a tab group.
BrowserTabGroup.collapsed
Gets or sets the collapsed state of a tab group.
BrowserTabGroup.browserWindow
Gets a tab group's context window.
BrowserTabGroup.tabs
Gets all open tabs within a tab group.
BrowserTabGroup.position
Gets the position of a tab group.

opera.extension.tabs

opera.extension.tabs.create()
Creates a new tab.
opera.extension.tabs.getAll()
Obtains a group of tabs (tab collection).
opera.extension.tabs.getFocused()
An alias for opera.extension.tabs.getSelected()
opera.extension.tabs.getSelected()
Obtains the currently selected tab, if any.
BrowserTab.close()
Closes a tab.
BrowserTab.focus()
Gives focus to a tab.
BrowserTab.update()
Updates the properties of a tab.
BrowserTab.id
Gets a unique identifier for a tab.
BrowserTab.closed
Gets the closed state of a tab.
BrowserTab.locked
Gets and sets the locked state of a tab.
BrowserTab.private
Gets and sets the privacy mode of a tab.
BrowserTab.selected
Gets the selected state of a tab.
BrowserTab.readyState
Gets the current document readiness of a tab.
BrowserTab.faviconUrl
Gets the URL of a tab's favicon.
BrowserTab.title
Gets the title of a tab.
BrowserTab.url
Gets and sets the url of a tab.
BrowserTab.browserWindow
Gets a tab's context window.
BrowserTab.tabGroup
Gets the tab group for a tab.
BrowserTab.position
Gets the position of a tab.
BrowserTab.focused
Sets the focused state of a tab.

Overview

A browser window is a graphical user-interface component that can contain zero or more browser tabs or browser tab groups. Each browser window has an associated tab collection and tab group collection. A browser window is the context window of each browser tab and browser tab group within its associated tab collection and tab group collection, respectively. A collection of browser windows is referred to as a window collection.

A browser tab group is a graphical user-interface component contained within a browser window that can contain zero or more browser tabs. Each browser tab group has an associated tab collection and is associated with a context window. A browser tab group is the context tab group of each browser tab within its associated tab collection. A collection of browser tab groups is referred to as the tab group collection.

A browser tab is a graphical user-interface component that represents a single page contained within a browser window. Each browser tab is associated with a browser window and might be associated with a browser tab group. A user can switch between browser tabs to access different pages. Selecting a browser tab brings that page into focus. A collection of browser tabs is referred to as the tab collection.

Example

The following example adds a button the browser toolbar. Clicking the button creates a tab group in a collapsed state containing two tabs. Each tab has a specified URL and one of them is a private tab.

<!-- 
  The configuration file ('config.xml').
-->
<?xml version='1.0' encoding='utf-8'?>
<widget xmlns="http://www.w3.org/ns/widgets" id="http://example.com/testextension" defaultlocale="en">
<name>Windows & Tabs test extension</name>
  <description>A test extension that opens a tab group containing two tabs.</description>
  <icon src="images/icon_64.png"/>
  <icon src="images/icon_18.png"/>
</widget>
//
// The background process (e.g. index.html)
//

// Specify the properties of the button before creating it.
var UIItemProperties = {
  disabled: false,
  title: "Tab creation test",
  icon: "images/icon_18.png",
  onclick: function() {
    // Create two tabs with specified URLs
    var tab1 = opera.extension.tabs.create({url: 'http://dev.opera.com/'});
    var tab2 = opera.extension.tabs.create({url: 'http://www.operamail.com/', private: true});
    
    // Create a tab group containing the above two tabs
    var tabGroup = opera.extension.tabGroups.create([tab1, tab2], {collapsed: true});
  }
};

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