A browsing context is a collection of one or
Document objects, and one or more views.
At any one time, one of the
Documents in a browsing context is the active
document. The collection of
Documents is the browsing context's session
A view is a user agent interface tied to a particular
media used for the presentation of
Document objects in some
media. A view may be interactive. Each view is represented by an
AbstractView object. Each view belongs to a browsing context. [DOM2VIEWS]
document attribute of an
AbstractView object representing a view
Document object of the view's browsing context's active
Events that use the
UIEvent interface are
related to a specific view (the view in which the
event happened); the
AbstractView of that view is given in
the event object's
view attribute. [DOM3EVENTS]
A typical Web browser has one obvious view per browsing context: the
browser's window (screen media). If a page is printed, however, a second
view becomes evident, that of the print media. The two views always share
the same underlying
Document, but they have a different
presentation of that document. A speech browser also establishes a
browsing context, one with a view in the speech media.
Document does not necessarily have a browsing context associated with it. In particular,
data mining tools are likely to never instantiate browsing contexts.
The main view through which a user primarily interacts with a user agent is the default view.
The default view of a
Document is given by the
attribute on the
When a browsing context is first created, it
must be created with a single
Document in its session
history, whose address is
about:blank, which is marked as being an HTML documents. The
have a single child
html node, which
itself has a single child
body node. If
the browsing context is created specifically to
be immediately navigated, then that initial navigation will have replacement enabled.
Certain elements (for example,
elements) can instantiate further browsing contexts. These are called nested browsing contexts. If a
browsing context P has an element in one of its
Documents D that nests another browsing
context C inside it, then P is
said to be the parent browsing context of C, C is said to be a child browsing context of P, and C is said to be nested through D.
The browsing context with no parent browsing context is the top-level browsing context of all the browsing contexts nested within it (either directly or indirectly through other nested browsing contexts).
Document is said to be fully active
when it is the active document of its browsing context, and either its browsing context is
a top-level browsing context, or the
Document through which that browsing context is nested is itself fully active.
Because they are nested through an element, child browsing contexts are always tied
to a specific
Document in their parent
browsing context. User agents must not allow the user to interact with
contexts of elements that are in
Documents that are not
themselves fully active.
It is possible to create new browsing contexts that are related to a top level browsing context without being nested through an element. Such browsing contexts are called auxiliary browsing contexts. Auxiliary browsing contexts are always top-level browsing contexts.
An auxiliary browsing context has an opener browsing context, which is the browsing context from which the auxiliary browsing context was created, and it has a furthest ancestor browsing context, which is the top-level browsing context of the opener browsing context when the auxiliary browsing context was created.
attribute on the
Window object must
Window object of the browsing context from which the current browsing
context was created (its opener browsing context),
if there is one and it is still available.
User agents may support secondary browsing contexts, which are browsing contexts that form part of the user agent's interface, apart from the main content area.
Each browsing context is defined as having a list of zero or more directly reachable browsing contexts. These are:
The transitive closure of all the browsing contexts that are directly reachable browsing contexts consists of a unit of related browsing contexts.
All the executable code in a unit of related browsing contexts must execute on a single conceptual thread. The dispatch of events fired by the user agent (e.g. in response to user actions or network activity) and the execution of any scripts associated with timers must be serialised so that for each unit of related browsing contexts there is only one script being executed at a time.
Browsing contexts can have a browsing context name. By default, a browsing context has no name (its name is not set).
A valid browsing context name is any string that
does not start with a U+005F LOW LINE character, or, a string that
case-insensitively matches one of:
_top. (Names starting with an underscore are reserved for
The rules for chosing a browsing context given a browsing context name are as follows. The rules assume that they are being applied in the context of a browsing context.
If the given browsing context name is the empty string or
_self, then the chosen browsing context must be the
If the given browsing context name is
then the chosen browsing context must be the parent browsing context of the current one,
unless there isn't one, in which case the chosen browsing context must
be the current browsing context.
If the given browsing context name is
the chosen browsing context must be the most top-level browsing context of the current one.
If the given browsing context name is not
and there exists a browsing context whose name is the same as the given browsing
context name, and one of the following is true:
...and the user agent determines that the two browsing contexts are related enough that it is ok if they reach each other, then that browsing context must be the chosen one. If there are multiple matching browsing contexts, the user agent should select one in some arbitrary consistent manner, such as the most recently opened, most recently focused, or more closely related.
Otherwise, a new browsing context is being requested, and what happens depends on the user agent's configuration and/or abilities:
_blank, then the new auxiliary browsing context's name must be the given browsing context name (otherwise, it has no name). The chosen browsing context must be this new browsing context. If it is immediately navigated, then the navigation will be done with replacement enabled.