차례
  1. 5 웹 페이지 로딩
    1. 5.1 브라우징 문맥
      1. 5.1.1 중첩된 브라우징 문맥
        1. 5.1.1.1 DOM에서 중첩된 브라우징 문맥 이동
      2. 5.1.2 보조 브라우징 문맥
        1. 5.1.2.1 DOM에서 보조 브라우징 문맥 이동
      3. 5.1.3 두번째 브라우징 문맥
      4. 5.1.4 보안
      5. 5.1.5 브라우징 문맥 그룹화
      6. 5.1.6 브라우징 문맥 이름
    2. 5.2 The Window object
      1. 5.2.1 보안
      2. 5.2.2 이름을 사용해서 브라우징 문맥을 생성하고 탐색하는 API
      3. 5.2.3 다른 브라우징 문맥 접근
      4. 5.2.4 Window 객체에 이름으로 접근
      5. 5.2.5 가비지 컬렉션과 브라우징 문맥
      6. 5.2.6 브라우저 인터페이스 요소
      7. 5.2.7 The WindowProxy object

5 웹 페이지 로딩

This section describes features that apply most directly to Web browsers. Having said that, except where specified otherwise, the requirements defined in this section do apply to all user agents, whether they are Web browsers or not.

5.1 브라우징 문맥

브라우징 문맥이란, Document 객체가 사용자에게 표현되어지는 환경입니다.

A browsing context is an environment in which Document objects are presented to the user.

웹 브라우저의 탭, 또는 창은 보통 문맥을 포함합니다. 프레임셋에서의 frame, 또는 iframe 역시 마찬가지입니다.

A tab or window in a Web browser typically contains a browsing context, as does an iframe or frames in a frameset.

각각의 브라우징 문맥들은 이에 대응하는 WindowProxy 객체를 갖습니다.

Each browsing context has a corresponding WindowProxy object.

문맥은 세션 히스토리를 갖습니다. 이것은 그 문맥에서 표현되었던, 표현되고 있는, 표현할 Document 객체들의 목록입니다.

A browsing context has a session history, which lists the Document objects that that browsing context has presented, is presenting, or will present. At any time, one Document in each browsing context is designated the active document.

각각의 Document 객체는 Window 객체와 연결됩니다. 문맥의 WindowProxy 객체는 모든것을 현재 문서의 Window 객체로 포워딩합니다.

Each Document is associated with a Window object. A browsing context's WindowProxy object forwards everything to the browsing context's active document's Window object.

일반적으로, Window 객체와 Document 객체 사이에는 1:1 대응관계가 있습니다. 한가지 특별한 경우는, Window 객체가 동일한 문맥에서 두번째 Document 객체의 표현을 위해 재사용되는 경우인데, 그러한 경우에는 2:1 대응관계가 만들어집니다. 이러한 일은 문맥이 최초의 about:blank Document 객체에서 다른 것으로 이동해 온 경우에 일어납니다.

In general, there is a 1-to-1 mapping from the Window object to the Document object. In one particular case, a Window can be reused for the presentation of a second Document in the same browsing context, such that the mapping is then 2-to-1. This occurs when a browsing context is navigated from the initial about:blank Document to another, with replacement enabled.

Document 객체가 문맥을 가져야만 하는 것은 아닙니다. 예를 들어 데이터 마이닝 툴 같은 경우에는 문맥을 전혀 만들지 않을 것입니다.

A Document does not necessarily have a browsing context associated with it. In particular, data mining tools are likely to never instantiate browsing contexts.


문맥은 생성자 문맥을 가질 수 있습니다. 현재의 문맥이 생성되는데 관여했던 것을 말합니다. 문맥이 부모 브라우징 문맥을 갖는다면, 그것이 생성자 문맥입니다. 그렇지 않을 경우, 문맥이 opener 문맥을 갖는다면, 그것이 생성자입니다. 그렇지도 않다면, 문맥은 생성자를 갖지 않는 것입니다.

A browsing context can have a creator browsing context, the browsing context that was responsible for its creation. If a browsing context has a parent browsing context, then that is its creator browsing context. Otherwise, if the browsing context has an opener browsing context, then that is its creator browsing context. Otherwise, the browsing context has no creator browsing context.

문맥 A가 생성자 문맥을 갖는다면, A가 생성되던 시점에서 활성 문서의 Document 객체였던 것이 생성자 Document가 됩니다.

If a browsing context A has a creator browsing context, then the Document that was the active document of that creator browsing context at the time A was created is the creator Document.

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 document, and whose character encoding is UTF-8. The Document must 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.

The origin of the about:blank Document is set when the Document is created. If the new browsing context has a creator browsing context, then the origin of the about:blank Document is the origin of the creator Document. Otherwise, the origin of the about:blank Document is a globally unique identifier assigned when the new browsing context is created.

5.1.1 중첩된 브라우징 문맥

특정 요소들(예를 들어, 아이프레임)은 문맥의 다른 인스턴스를 만들 수 있습니다. 이러한 것을 중첩된 문맥이라 합니다. 문맥 P가, 자신의 Document 객체 D 내부에 요소 E를 갖고 있고, E는 중첩된 문맥인 C를 갖고 있다면, P를 C의 부모 문맥이라 하며, C는 P의 자식 문맥이라 합니다. C는 D를 통해 중첩되었다 하며, E는 C의 문맥 컨테이너라고 합니다.

Certain elements (for example, iframe elements) can instantiate further browsing contexts. These are called nested browsing contexts. If a browsing context P has a Documents D with an element E that nests another browsing context C inside it, then C is said to be nested through D, and E is said to be the browsing context container of C. If the browsing context container element E is in the Document D, then P is said to be the parent browsing context of C and C is said to be a child browsing context of P. Otherwise, the nested browsing context C has no parent browsing context.

문맥 A' 라는 것이 있어서 이것이 A의 자식 문맥이고, 또한 그것이 B의 조상이거나, A의 자식 문맥이면서 동시에 B의 조상 문맥인 P가 있다면, 문맥 A를 문맥 B의 조상이라고 합니다.

A browsing context A is said to be an ancestor of a browsing context B if there exists a browsing context A' that is a child browsing context of A and that is itself an ancestor of B, or if there is a browsing context P that is a child browsing context of A and that is the parent browsing context of B.

조상 문맥을 갖지 않는 문맥은 자기 내부에 포함된 모든 문맥들의 최상위 문맥입니다. (직접적인 포함이거나, 다른 문맥을 걸쳐서 포함되는것 모두를 말합니다)

A browsing context that is not a nested browsing context has no parent browsing context, and is the top-level browsing context of all the browsing contexts for which it is an ancestor browsing context.

중첩된 문맥에 대해 부모 문맥의 전이적인 클로저는 조상 문맥의 목록을 제공합니다.

The transitive closure of parent browsing contexts for a nested browsing context gives the list of ancestor browsing contexts.

Document d 의 자손 문맥들의 리스트는 다음의 알고리즘을 통해 반환되는 리스트입니다:

The list of the descendant browsing contexts of a Document d is the (ordered) list returned by the following algorithm:

  1. 빈 목록 list 가 있습니다.

    Let list be an empty list.

  2. d 에 포함된 요소를 통하여 중첩된 d 의 자식 문맥 각각을, 그러한 문맥들을 포함하고 있는 요소들의 트리 순서로, 다음과 같이 list 에 더합니다.

    For each child browsing context of d that is nested through an element that is in the Document d, in the tree order of the elements nesting those browsing contexts, run these substeps:

    1. 자식 문맥을 list에 더합니다.

      Append that child browsing context to the list list.

    2. 자식 문맥의 현재 문서의 자손 문맥 목록을 list에 더합니다.

      Append the list of the descendant browsing contexts of the active document of that child browsing context to the list list.

  3. list를 반환합니다.

    Return the constructed list.

Document가 문맥의 활성 문서이며 그 문맥이 최상위 문맥이거나, 그 자신을 통하여 중첩되었을 경우, 그러한 Document를 완전히 활성fully active 이라고 합니다.

A 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 it has a parent browsing context and the Document through which it is nested is itself fully active.

요소를 통하여 중첩된 것이므로, 자식 문맥들은 항상 그 조상 문맥의 특정한 Document 에 묶여 있습니다. 사용자 에이전트는 사용자가 완전히 활성이지 않은 Document의 요소인 자식 문맥들과 상호작용하는 것을 허용해서는 안됩니다.

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 child browsing contexts of elements that are in Documents that are not themselves fully active.

중첩된 문맥은 iframe 요소를 통하여 중첩되었고 그 요소가 seamless 속성을 가진 경우 seamless 문맥 플랙을 가질 수 있습니다.

A nested browsing context can have a seamless browsing context flag set, if it is embedded through an iframe element with a seamless attribute.

중첩된 문맥을 부모 문맥으로부터 꺼낼 수 있는 경우가 있습니다 (예를 들어, ifrma 요소를 그 Document에서 제거한 경우입니다). 이러한 경우, 중첩된 문맥은 부모 문맥을 갖지 않지만, 동일한 문맥 컨테이너를 가지고 있으며 그 요소의 Document를 통해 중첩될 수 있습니다. 그러한 중첩된 문맥은 최상위 문맥이 아니며, 완전히 활성인 Document를 포함할 수 없습니다. 또한, 문맥 컨테이너(iframe 같은)가 다른 Document로 옮겨졌을 경우, 그 중첩된 문맥의 부모 문맥이 변경될 것입니다.

A nested browsing context can in some cases be taken out of its parent browsing context (e.g. if an iframe element is removed from its Document). In such a situation, the nested browsing context has no parent browsing context, but it still has the same browsing context container and is still nested through that element's Document. Such a nested browsing context is not a top-level browsing context, and cannot contain Documents that are fully active. Furthermore, if a browsing context container (such as an iframe) is moved to another Document, then the parent browsing context of its nested browsing context will change.

window . top

최상위 문맥의 WindowProxy를 반환합니다.

Returns the WindowProxy for the top-level browsing context.

window . parent

부모 문맥의 WindowProxy를 반환합니다.

Returns the WindowProxy for the parent browsing context.

window . frameElement

문맥을 포함하고 있는 요소를 반환합니다.

Returns the Element for the browsing context container.

그러한 것이 없다면 null을 반환합니다.

Returns null if there isn't one.

크로스-오리진 상황에서는 SECURITY_ERR을 반환합니다.

Throws a SECURITY_ERR exception in cross-origin situations.

The top IDL attribute on the Window object of a Document in a browsing context b must return the WindowProxy object of its top-level browsing context (which would be its own WindowProxy object if it was a top-level browsing context itself), if it has one, or its own WindowProxy object otherwise (e.g. if it was a detached nested browsing context).

The parent IDL attribute on the Window object of a Document in a browsing context b must return the WindowProxy object of the parent browsing context, if there is one (i.e. if b is a child browsing context), or the WindowProxy object of the browsing context b itself, otherwise (i.e. if it is a top-level browsing context or a detached nested browsing context).

The frameElement IDL attribute on the Window object of a Document d, on getting, must run the following algorithm:

  1. If d is not a Document in a nested browsing context, return null and abort these steps.

  2. If the browsing context container's Document does not have the same effective script origin as the entry script, then throw a SECURITY_ERR exception.

  3. Otherwise, return the browsing context container for b.

5.1.2 보조 브라우징 문맥

최상위 문맥과 관련되어 있는 문맥을, 요소를 통하여 중첩하지 않고도 생성할 수 있습니다. 이러한 문맥을 보조 문맥이라고 합니다. 보조 문맥은 항상 최상위 문맥입니다.

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.

보조 문맥은 opener 문맥을 갖는데, 이것은 그것으로부터 보조 문맥이 생성된 문맥입니다. 이러한 opener 문맥은 최상위 조상 문맥을 갖는데, 보조 문맥을 생성시킨 opener 문맥의 최상위 문맥입니다.

An auxiliary browsing context has an opener browsing context, which is the browsing context from which the auxiliary browsing context was created.

Window 객체의 IDL 속성 opener는 반드시 현재의 문맥을 생성한 문맥(즉, opener 문맥)의 WindowProxy 객체를 반환하여야 합니다.

The opener IDL attribute on the Window object must return the WindowProxy 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.

5.1.3 두번째 브라우징 문맥

사용자 에이전트는 2차 문맥을 지원할 수 있습니다. 2차 문맥이란 주 컨텐츠 영역과는 별개로, 사용자 에이전트의 인터페이스 부분을 구성하는 문맥입니다

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.

5.1.4 보안

A browsing context A is allowed to navigate a second browsing context B if one of the following conditions is true:


An element has a browsing context scope origin if its Document's browsing context is a top-level browsing context or if all of its Document's ancestor browsing contexts all have active documents whose origin are the same origin as the element's Document's origin. If an element has a browsing context scope origin, then its value is the origin of the element's Document.

5.1.5 브라우징 문맥 그룹화

Each browsing context is defined as having a list of one or more directly reachable browsing contexts. These are:

The transitive closure of all the browsing contexts that are directly reachable browsing contexts forms a unit of related browsing contexts.

Each unit of related browsing contexts is then further divided into the smallest number of groups such that every member of each group has an active document with an effective script origin that, through appropriate manipulation of the document.domain attribute, could be made to be the same as other members of the group, but could not be made the same as members of any other group. Each such group is a unit of related similar-origin browsing contexts.

Each unit of related similar-origin browsing contexts can have a entry script which is used to obtain, amongst other things, the script's base URL to resolve relative URLs used in scripts running in that unit of related similar-origin browsing contexts. Initially, there is no entry script. It is changed by the jump to a code entry-point algorithm.

There is at most one event loop per unit of related similar-origin browsing contexts.

5.1.6 브라우징 문맥 이름

문맥들은 문맥 이름을 가질 수 있습니다. 기본값으로, 문맥은 이름을 갖지 않습니다(이름이 설정되지 않았음을 뜻합니다).

Browsing contexts can have a browsing context name. By default, a browsing context has no name (its name is not set).

유효한 문맥 이름은 _ 문자로 시작하지 않는 1개 이상의 문자입니다. (_ 문자로 시작하는 문자열은 특수한 키워드들을 위해 예약된 것입니다)

A valid browsing context name is any string with at least one character that does not start with a U+005F LOW LINE character. (Names starting with an underscore are reserved for special keywords.)

유효한 문맥 이름 또는 키워드 란, 유효한 문맥 이름이거나, 아스키, 대소문자 구분 없이 다음의 것들중 하나와 일치하는 것입니다: _blank, _self, _parent, _top.

A valid browsing context name or keyword is any string that is either a valid browsing context name or that is an ASCII case-insensitive match for one of: _blank, _self, _parent, or _top.

The rules for choosing 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.

  1. If the given browsing context name is the empty string or _self, then the chosen browsing context must be the current one.

    If the given browsing context name is _self, then this is an explicit self-navigation override, which overrides the behavior of the seamless browsing context flag set by the seamless attribute on iframe elements.

  2. If the given browsing context name is _parent, 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.

  3. If the given browsing context name is _top, then the chosen browsing context must be the top-level browsing context of the current one, if there is one, or else the current browsing context.

  4. If the given browsing context name is not _blank and there exists a browsing context whose name is the same as the given browsing context name, and the current browsing context is allowed to navigate that browsing context, 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.

    If the browsing context is chosen by this step to be the current browsing context, then this is also an explicit self-navigation override.

  5. Otherwise, a new browsing context is being requested, and what happens depends on the user agent's configuration and/or abilities:

    If the current browsing context had the sandboxed navigation browsing context flag set when its active document was created.

    The user agent may offer to create a new top-level browsing context or reuse an existing top-level browsing context. If the user picks one of those options, then the designated browsing context must be the chosen one (the browsing context's name isn't set to the given browsing context name). Otherwise (if the user agent doesn't offer the option to the user, or if the user declines to allow a browsing context to be used) there must not be a chosen browsing context.

    If the user agent has been configured such that in this instance it will create a new browsing context, and the browsing context is being requested as part of following a hyperlink whose link types include the noreferrer keyword

    A new top-level browsing context must be created. If the given browsing context name is not _blank, then the new top-level 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.

    If the user agent has been configured such that in this instance it will create a new browsing context, and the noreferrer keyword doesn't apply

    A new auxiliary browsing context must be created, with the opener browsing context being the current one. If the given browsing context name is not _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.

    If the user agent has been configured such that in this instance it will reuse the current browsing context

    The chosen browsing context is the current browsing context.

    If the user agent has been configured such that in this instance it will not find a browsing context

    There must not be a chosen browsing context.

    User agent implementors are encouraged to provide a way for users to configure the user agent to always reuse the current browsing context.

5.2 The Window object

[ReplaceableNamedProperties]  
interface Window {
  // the current browsing context
  readonly attribute WindowProxy window;
  readonly attribute WindowProxy self;
  readonly attribute Document document;
           attribute DOMString name;  
  [PutForwards=href] readonly attribute Location location;
  readonly attribute History history;
  [Replaceable] readonly attribute BarProp locationbar;
  [Replaceable] readonly attribute BarProp menubar;
  [Replaceable] readonly attribute BarProp personalbar;
  [Replaceable] readonly attribute BarProp scrollbars;
  [Replaceable] readonly attribute BarProp statusbar;
  [Replaceable] readonly attribute BarProp toolbar; 
  void close();
  void stop();
  void focus();
  void blur();
 
  // other browsing contexts
  [Replaceable] readonly attribute WindowProxy frames;
  [Replaceable] readonly attribute unsigned long length;
  readonly attribute WindowProxy top;
  [Replaceable] readonly attribute WindowProxy opener;
  readonly attribute WindowProxy parent;
  readonly attribute Element frameElement;
  WindowProxy open(in optional DOMString url, in optional DOMString target, in optional DOMString features, in optional DOMString replace);
  getter WindowProxy (in unsigned long index);
  getter any (in DOMString name);
 
  // the user agent
  readonly attribute Navigator navigator;  
  readonly attribute ApplicationCache applicationCache;
 
  // user prompts
  void alert(in DOMString message);
  boolean confirm(in DOMString message);
  DOMString prompt(in DOMString message, in optional DOMString default);
  void print();
  any showModalDialog(in DOMString url, in optional any argument);
 
  // event handler IDL attributes 
           attribute Function onabort;
           attribute Function onafterprint;
           attribute Function onbeforeprint;
           attribute Function onbeforeunload;
           attribute Function onblur;
           attribute Function oncanplay;
           attribute Function oncanplaythrough;
           attribute Function onchange;
           attribute Function onclick;
           attribute Function oncontextmenu;
 
           attribute Function oncuechange;
 
           attribute Function ondblclick;
           attribute Function ondrag;
           attribute Function ondragend;
           attribute Function ondragenter;
           attribute Function ondragleave;
           attribute Function ondragover;
           attribute Function ondragstart;
           attribute Function ondrop;
           attribute Function ondurationchange;
           attribute Function onemptied;
           attribute Function onended;
           attribute Function onerror;
           attribute Function onfocus;
           attribute Function onformchange;
           attribute Function onforminput;
           attribute Function onhashchange;
           attribute Function oninput;
           attribute Function oninvalid;
           attribute Function onkeydown;
           attribute Function onkeypress;
           attribute Function onkeyup;
           attribute Function onload;
           attribute Function onloadeddata;
           attribute Function onloadedmetadata;
           attribute Function onloadstart;
           attribute Function onmessage;
           attribute Function onmousedown;
           attribute Function onmousemove;
           attribute Function onmouseout;
           attribute Function onmouseover;
           attribute Function onmouseup;
           attribute Function onmousewheel;
           attribute Function onoffline;
           attribute Function ononline;
           attribute Function onpause;
           attribute Function onplay;
           attribute Function onplaying;
           attribute Function onpagehide;
           attribute Function onpageshow;
           attribute Function onpopstate;
           attribute Function onprogress;
           attribute Function onratechange;
           attribute Function onreadystatechange;
           attribute Function onredo;
           attribute Function onreset;
           attribute Function onresize;
           attribute Function onscroll;
           attribute Function onseeked;
           attribute Function onseeking;
           attribute Function onselect;
           attribute Function onshow;
           attribute Function onstalled;
           attribute Function onstorage;
           attribute Function onsubmit;
           attribute Function onsuspend;
           attribute Function ontimeupdate;
           attribute Function onundo;
           attribute Function onunload;
           attribute Function onvolumechange;
           attribute Function onwaiting;
};
Window implements EventTarget;
window . window
window . frames
window . self

이 속성들은 모두 window를 반환합니다.

These attributes all return window.

window . document

현재 문서를 반환합니다.

Returns the active document.

document . defaultView

현재 문서의 Window 객체를 반환합니다.

Returns the Window object of the active document.

The window, frames, and self IDL attributes must all return the Window object's browsing context's WindowProxy object.

The document IDL attribute must return the Document object of the Window object's Document's browsing context's active document.

The defaultView IDL attribute of the HTMLDocument interface must return the Document's browsing context's WindowProxy object, if there is one, or null otherwise.

5.2.1 보안

User agents must raise a SECURITY_ERR exception whenever any of the members of a Window object are accessed by scripts whose effective script origin is not the same as the Window object's Document's effective script origin, with the following exceptions:

When a script whose effective script origin is not the same as the Window object's Document's effective script origin attempts to access that Window object's methods or attributes, the user agent must act as if any changes to the Window object's properties, getters, setters, etc, were not present.

For members that return objects (including function objects), each distinct effective script origin that is not the same as the Window object's Document's effective script origin must be provided with a separate set of objects. These objects must have the prototype chain appropriate for the script for which the objects are created (not those that would be appropriate for scripts whose script's global object is the Window object in question).

For instance, if two frames containing Documents from different origins access the same Window object's postMessage() method, they will get distinct objects that are not equal.

5.2.2 이름을 사용해서 브라우징 문맥을 생성하고 탐색하는 API

window = window . open( [ url [, target [, features [, replace ] ] ] ] )

다음과 같은 창을 열고, 또한 그것을 반환합니다: url(기본값은 about:blank 입니다). target 속서으로 창의 이름을 나타냅니다. 만약 그러한 이름의 창이 이미 존재한다면, 그것을 다시 사용합니다. replace 속성이 참일 경우, 그 창에 무엇이 들어 있든 그것은 창의 세션 히스토리에서 지워지게 됩니다. features 매개변수는 무시됩니다.

Opens a window to show url (defaults to about:blank), and returns it. The target argument gives the name of the new window. If a window exists with that name already, it is reused. The replace attribute, if true, means that whatever page is currently open in that window will be removed from the window's session history. The features argument is ignored.

window . name [ = value ]

창의 이름을 반환합니다.

Returns the name of the window.

창의 이름을 변경할 수 있습니다.

Can be set, to change the name.

window . close()

창을 닫습니다.

Closes the window.

window . stop()

문서 로드를 취소합니다.

Cancels the document load.

The open() method on Window objects provides a mechanism for navigating an existing browsing context or opening and navigating an auxiliary browsing context.

The method has four arguments, though they are all optional.

The first argument, url, must be a valid non-empty URL for a page to load in the browsing context. If no arguments are provided, or if the first argument is the empty string, then the url argument defaults to "about:blank". The argument must be resolved to an absolute URL (or an error), relative to the entry script's base URL, when the method is invoked.

The second argument, target, specifies the name of the browsing context that is to be navigated. It must be a valid browsing context name or keyword. If fewer than two arguments are provided, then the target argument defaults to the value "_blank".

The third argument, features, has no defined effect and is mentioned for historical reasons only. User agents may interpret this argument as instructions to set the size and position of the browsing context, but are encouraged to instead ignore the argument entirely.

The fourth argument, replace, specifies whether or not the new page will replace the page currently loaded in the browsing context, when target identifies an existing browsing context (as opposed to leaving the current page in the browsing context's session history). When three or fewer arguments are provided, replace defaults to false.

When the method is invoked, the user agent must first select a browsing context to navigate by applying the rules for choosing a browsing context given a browsing context name using the target argument as the name and the browsing context of the script as the context in which the algorithm is executed, unless the user has indicated a preference, in which case the browsing context to navigate may instead be the one indicated by the user.

For example, suppose there is a user agent that supports control-clicking a link to open it in a new tab. If a user clicks in that user agent on an element whose onclick handler uses the window.open() API to open a page in an iframe, but, while doing so, holds the control key down, the user agent could override the selection of the target browsing context to instead target a new tab.

Then, the user agent must navigate the selected browsing context to the absolute URL (or error) obtained from resolving url earlier. If the replace is true or if the browsing context was just created as part of the rules for choosing a browsing context given a browsing context name, then replacement must be enabled. The navigation must be done with the browsing context of the entry script as the source browsing context.

The method must return the WindowProxy object of the browsing context that was navigated, or null if no browsing context was navigated.


The name attribute of the Window object must, on getting, return the current name of the browsing context, and, on setting, set the name of the browsing context to the new value.

The name gets reset when the browsing context is navigated to another domain.


The close() method on Window objects should, if the corresponding browsing context A is an auxiliary browsing context that was created by a script (as opposed to by an action of the user), and if the browsing context of the script that invokes the method is allowed to navigate the browsing context A, close the browsing context A (and may discard it too).

The stop() method on Window objects should, if there is an existing attempt to navigate the browsing context and that attempt is not currently running the unload a document algorithm, cancel that navigation and any associated instances of the fetch algorithm. Otherwise, it must do nothing.

5.2.3 다른 브라우징 문맥 접근

window . length

자식 문맥의 숫자를 반환합니다.

Returns the number of child browsing contexts.

window[index]

지정된 자식 문맥을 반환합니다.

Returns the indicated child browsing context.

The length IDL attribute on the Window interface must return the number of child browsing contexts that are nested through elements that are in the Document that is the active document of that Window object, if that Window's browsing context shares the same event loop as the script's browsing context of the entry script accessing the IDL attribute; otherwise, it must return zero.

The supported property indices on the Window object at any instant are the numbers in the range 0 .. n-1, where n is the number returned by the length IDL attribute. If n is zero then there are no supported property indices.

To determine the value of an indexed property index of a Window object, the user agent must return the WindowProxy object of the indexth child browsing context of the Document that is nested through an element that is in the Document, sorted in the tree order of the elements nesting those browsing contexts.

These properties are the dynamic nested browsing context properties.

5.2.4 Window 객체에 이름으로 접근

window[name]

지정된 요소, 또는 요소의 컬렉션을 반환합니다.

Returns the indicated element or collection of elements.

The Window interface supports named properties. The supported property names at any moment consist of:

When the Window object is indexed for property retrieval using a name name, then the user agent must return the value obtained using the following steps:

  1. Let elements be the list of named elements with the name name in the active document.

    There will be at least one such element, by definition.

  2. If elements contains an iframe element, then return the WindowProxy object of the nested browsing context represented by the first such iframe element in tree order, and abort these steps.

  3. Otherwise, if elements has only one element, return that element and abort these steps.

  4. Otherwise return an HTMLCollection rooted at the Document node, whose filter matches only named elements with the name name.

Named elements with the name name, for the purposes of the above algorithm, are those that are either:

5.2.5 가비지 컬렉션과 브라우징 문맥

A browsing context has a strong reference to each of its Documents and its WindowProxy object, and the user agent itself has a strong reference to its top-level browsing contexts.

A Document has a strong reference to its Window object.

A Window object has a strong reference to its Document object through its document attribute. Thus, references from other scripts to either of those objects will keep both alive. Similarly, both Document and Window objects have implied strong references to the WindowProxy object.

Each script has a strong reference to its browsing context and its document.

When a browsing context is to discard a Document, the user agent must run the following steps:

  1. Set the Document's salvageable state to false.

  2. Run any unloading document cleanup steps for the Document that are defined by this specification and other applicable specifications.

  3. Remove any tasks associated with the Document in any task source, without running those tasks.

  4. Discard all the child browsing contexts of the Document.

  5. Lose the strong reference from the Document's browsing context to the Document.

Whenever a Document object is discarded, it is also removed from the list of the worker's Documents of each worker whose list contains that Document.

When a browsing context is discarded, the strong reference from the user agent itself to the browsing context must be severed, and all the Document objects for all the entries in the browsing context's session history must be discarded as well.

User agents may discard top-level browsing contexts at any time (typically, in response to user requests, e.g. when a user closes a window containing one or more top-level browsing contexts). Other browsing contexts must be discarded once their WindowProxy object is eligible for garbage collection.

5.2.6 브라우저 인터페이스 요소

웹 페이지가 브라우저와 통합되도록 하기 위해, 특정한 브라우저 인터페이스 요소들이 제한된 방법으로 웹 페이지 스크립트에 노출됩니다.

To allow Web pages to integrate with Web browsers, certain Web browser interface elements are exposed in a limited way to scripts in Web pages.

각각의 인터페이스 요소들은 BarProp 객체로 나타내어집니다:

Each interface element is represented by a BarProp object:

interface BarProp {
           attribute boolean visible;
};
window . locationbar . visible

위치 바가 보일 경우 참을 반환합니다. 아니라면 거짓을 반환합니다.

Returns true if the location bar is visible; otherwise, returns false.

window . menubar . visible

메뉴 바가 보일 경우 참을 반환합니다. 아니라면 거짓을 반환합니다.

Returns true if the menu bar is visible; otherwise, returns false.

window . personalbar . visible

퍼스널 바가 보일 경우 참을 반환합니다. 아니라면 거짓을 반환합니다.

Returns true if the personal bar is visible; otherwise, returns false.

window . scrollbars . visible

스크롤 바가 보일 경우 참을 반환합니다. 아니라면 거짓을 반환합니다.

Returns true if the scroll bars are visible; otherwise, returns false.

window . statusbar . visible

상태 바가 보일 경우 참을 반환합니다. 아니라면 거짓을 반환합니다.

Returns true if the status bar is visible; otherwise, returns false.

window . toolbar . visible

툴바가 보일 경우 참을 반환합니다. 아니라면 거짓을 반환합니다.

Returns true if the toolbar is visible; otherwise, returns false.

The visible attribute, on getting, must return either true or a value determined by the user agent to most accurately represent the visibility state of the user interface element that the object represents, as described below. On setting, the new value must be discarded.

The following BarProp objects exist for each Document object in a browsing context. Some of the user interface elements represented by these objects might have no equivalent in some user agents; for those user agents, except when otherwise specified, the object must act as if it was present and visible (i.e. its visible attribute must return true).

The location bar BarProp object
Represents the user interface element that contains a control that displays the URL of the active document, or some similar interface concept.
The menu bar BarProp object
Represents the user interface element that contains a list of commands in menu form, or some similar interface concept.
The personal bar BarProp object
Represents the user interface element that contains links to the user's favorite pages, or some similar interface concept.
The scrollbar BarProp object
Represents the user interface element that contains a scrolling mechanism, or some similar interface concept.
The status bar BarProp object
Represents a user interface element found immediately below or after the document, as appropriate for the user's media. If the user agent has no such user interface element, then the object may act as if the corresponding user interface element was absent (i.e. its visible attribute may return false).
The toolbar BarProp object
Represents the user interface element found immediately above or before the document, as appropriate for the user's media. If the user agent has no such user interface element, then the object may act as if the corresponding user interface element was absent (i.e. its visible attribute may return false).

The locationbar attribute must return the location bar BarProp object.

The menubar attribute must return the menu bar BarProp object.

The personalbar attribute must return the personal bar BarProp object.

The scrollbars attribute must return the scrollbar BarProp object.

The statusbar attribute must return the status bar BarProp object.

The toolbar attribute must return the toolbar BarProp object.

5.2.7 The WindowProxy object

As mentioned earlier, each browsing context has a WindowProxy object. This object is unusual in that all operations that would be performed on it must be performed on the Window object of the browsing context's active document instead. It is thus indistinguishable from that Window object in every way until the browsing context is navigated.

There is no WindowProxy interface object.

The WindowProxy object allows scripts to act as if each browsing context had a single Window object, while still keeping separate Window objects for each Document.

In the following example, the variable x is set to the WindowProxy object returned by the window accessor on the global object. All of the expressions following the assignment return true, because in every respect, the WindowProxy object acts like the underlying Window object.

var x = window;
x instanceof Window; // true
x === this; // true