opera.extension.windows.create()
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:
tabs (optional): The tab, tab group or tab properties of the new window.properties (optional): The properties of the new window, such as its position/dimensions or whether it's private.
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);
This article is licensed under a Creative Commons Attribution 3.0 Unported license.
Comments
No new comments accepted.