BrowserTab.private

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.

Description:

Attribute

The readonly private attribute exposes the privacy mode of the browser tab. On getting, the private attribute returns true if the privacy mode of the browser tab is private, otherwise it returns false.

Property

When specified as an item in a BrowserTabProperties object, the private property indicates the desired privacy mode of a browser tab. The value true indicates that the tab should be private, whereas the value false indicates that the tab's privacy mode should be normal.

When creating a browser tab, if this property is not specified, the default behaviour is to inherit the privacy mode of the context window.

When updating a browser tab, this property has no effect, whether specified or not. The privacy mode remains unchanged.

Syntax:

Attribute

readonly boolean private

Property

boolean private

Example:

The following example creates a button on the browser toolbar. When the button is clicked, a private tab is created with the specified URL.

//
// 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() {
    // Create a tab properties object
    var tabProps = {
      url: 'http://www.operamail.com/',
      private: true
    };
    
    // Create a tab with the specified properties
    var tab = opera.extension.tabs.create(tabProps);
  }
};

// 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.