Safari Reference Library Apple Developer
Search

SafariBrowserWindow Class Reference

Technology area
Safari Extensions
Availability
Available in Safari 5.0 and later.

Overview

Instances of the SafariBrowserWindow class represent browser windows. Each window contains one or more tabs, which display web content.

Tasks

Getting Information About Windows

Interacting With Windows

Properties

activeTab

The tab currently being displayed in the window.

readonly attribute SafariBrowserTab activeTab
Availability

tabs

The tabs in the window.

readonly attribute array tabs
Discussion

The tabs are ordered in the array from left to right.

Availability

visible

A Boolean value that indicates whether the window is visible.

readonly attribute boolean visible
Discussion

This attribute is true if the window is being displayed, even if it is covered by other windows. It is false if the window has been minimized.

Availability

Methods

activate

Brings the window to the front and gives it keyboard focus.

void activate (void);

Availability
  • Available in Safari 5.0 and later.

close

Requests that the window should close.

void close (void);

Discussion

This method behaves like clicking the window’s close button—it does not necessarily cause the window to close. After a window closes, the value of all of its properties is undefined and all of its prototype’s methods return undefined.

Availability
  • Available in Safari 5.0 and later.

insertTab

Inserts a tab into the window.

void insertTab (in SafariBrowserTab tab, in long index);

Parameters
tab

The tab being inserted.

index

The location where the tab is being inserted.

Availability
  • Available in Safari 5.0 and later.

openTab

Opens a new tab in the window.

SafariBrowserTab openTab (in DOMString visibility, in long index);

Parameters
visibility

Either foreground if the tab should be opened in the foreground, or background if it should be opened in the background. Optional.

index

The desired location of the new tab. Optional.

Return Value

A new tab.

Discussion

The default visibility is foreground, used when visibility is omitted or undefined. An invalid value causes an exception.

Tab indexes start at 0 on the far left and increases going to the right. The default location is at the far right. If index is negative, the tab is inserted at the far left; if index is greater than the number of tabs currently open, the tab is inserted at the far right.

Availability
  • Available in Safari 5.0 and later.



Last updated: 2010-06-29

Did this document help you? Yes It's good, but... Not helpful...