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.



The readonly focused attribute exposes the focused state of the browser window. On getting, the focused attribute returns true if the browser window is focused, otherwise it returns false.


When specified as an item in a BrowserWindowProperties object, the focused property indicates the desired focus state of a browser window. The value true indicates that the window should be focused, and false indicates that the focus state should not change.

When creating or updating a browser window, if this property is not specified, the default behaviour is the same as specifying false.

Note: The focused property is only a hint. Certain conditions and platform conventions might cause a window to be focused or not regardless of the specified value.



readonly boolean focused


boolean focused


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

// 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
    var win =;

    // Update the window to give it focus
    win.update({focused: true});

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

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


No new comments accepted.