« Documentation Home

opera.extension.windows.create()

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.

Description:

The create() method provides a way to create a new browser window. When the create() method is invoked, the implementation must run the algorithm to create a window using tabs and properties as the argument, if provided.

Parameters:

Syntax:

BrowserWindow create (optional Object[] tabs, optional BrowserWindowProperties properties)

Example:

The following example creates a button in the browser toolbar. When the button is clicked, a new, empty browser window is created.

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

// Specify the properties of the button before creating it.
var UIItemProperties = {
  disabled: false,
  title: "Window creation test",
  icon: "images/icon_18.png",
  onclick: function() {
    // Open a new browser window
    opera.extension.windows.create();
  }
};

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