Developers › Dev.Opera

BrowserTab.private

April 26, 2012 · by Opera Software

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);

About this article

Published inDev.Opera
DateApril 26, 2012
AuthorOpera Software
Tagsextensions API, Windows and Tabs
OriginalInternet Archive