喝水有什么好处| 乳腺增生1类什么意思| 葡萄酒中的单宁是什么| 犯太岁是什么意思| 做肠镜前一天可以吃什么| 狗狗咬主人意味着什么| 什么是癔症病| 纯水是什么水| 肾钙化是什么意思| 男人吃什么食物可以补肾壮阳| 婚姻是爱情的坟墓是什么意思| 付之东流是什么意思| 能量守恒是什么意思| 看指甲去医院挂什么科| 生理盐水是什么| 廓清是什么意思| 白带发黄是什么原因引起的| 广西属于什么方向| 普洱茶有什么功效与作用| 音欠读什么| 子宫在肚脐眼什么位置| 爆血管是什么原因引起的| 三年级用什么笔| 抬旗是什么意思| 宝宝头发黄是缺什么| 手臂痛什么原因| 腮腺炎是什么症状| 双侧附睾头囊肿是什么意思| 木有什么意思| 哺乳期感冒吃什么药不影响哺乳| 秋葵吃多了有什么坏处| 强度是什么意思| 被舔下面什么感觉| 脚气是什么症状| 胎儿腹围偏大说明什么| 牙龈爱出血是什么原因| bodywash是什么意思| 美的不可方物是什么意思| c是什么| 睛可以组什么词| 窦性心律不齐是什么| 莓茶是什么茶| 狒狒是什么意思| 汗蒸和桑拿有什么区别| 春天有什么植物| 早上手肿胀是什么原因| 大豆磷脂是什么| 韬的意思是什么| 碧螺春是什么茶| 太阳穴长痘是什么原因| 同房什么意思| 东北方是什么方位| 开店需要什么手续| 脚褪皮是什么原因| 什么地游泳| 为什么人会衰老| 庖丁是什么意思| 眼晴干涩模糊用什么药| 高血压适合喝什么茶| 痔疮初期症状是什么| 心动过速吃什么药| 病毒性发烧吃什么药| 来龙去脉指什么生肖| 齐耳短发适合什么脸型| 胖子从12楼掉下来会变什么| 气血不足吃什么食物| 什么是血清| 小孩血糖高有什么症状| 梅毒螺旋体抗体是什么意思| 玉溪烟属于什么档次| 1997年什么命| 十月30号是什么星座| 精神洁癖是什么| 见风使舵是什么生肖| 什么是夹腿| 开什么节什么的成语| 人才辈出是什么意思| 口腔溃疡为什么那么痛| 孩子嗓子疼吃什么药| 姓杨的女孩子取什么名字| 梦见别人打架是什么意思| 小孩眼屎多是什么原因引起的| 右胸是什么器官| 小猫的胡须有什么作用| 12月13日是什么星座| 舌苔发黄是什么原因引起的| 肾结石有什么影响| 褪黑素不能和什么一起吃| 红白相间是什么意思| 脑供血不足吃什么中成药| 1987是什么年| 什么是低密度脂蛋白胆固醇| 小孩肚脐眼周围疼是什么原因| delvaux是什么牌子| 什么是清关| 女性阴道痒是什么原因| 9月14日是什么星座| 什么是化学阉割| 尿液清澈透明说明什么| 猴子屁股为什么是红色| 心气虚吃什么中成药| 10月24号什么星座| 744是什么意思| 警犬都是什么品种| 能说会道是什么生肖| 限期使用日期是什么意思| 肤色暗黄适合穿什么颜色的衣服| 通班是什么意思| 手指关节痛是什么原因| 有何贵干是什么意思| 喝酒头晕是什么原因| 戒烟吃什么药| 什么是肠息肉| wz是什么意思| 快餐是什么意思| 不知道叫什么名字好| 孕晚期高血压对胎儿有什么影响| 鼻烟是什么东西| 附子理中丸治什么病| 2020年什么年| 中药天龙又叫什么| skechers是什么牌子| 夫复何求是什么意思| 2023属什么生肖| 喉炎雾化用什么药| 舌头上长泡是什么原因| 重复肾是什么意思| 爆表是什么意思| 跖疣念什么字| 焦是什么意思| 手抖是什么病| 女人性冷淡吃什么药效果好| 青蛇是什么蛇| 前列腺肥大是什么症状| 今晚开什么特马| 胆固醇高对身体有什么危害| 夏天喝什么汤好| 玉米有什么营养价值| 嬴政和芈月是什么关系| 什么叫慢阻肺| 什么原因导致卵巢早衰| 梅尼埃综合症是什么病| 老人走之前有什么预兆| 全脂牛奶是什么意思| 夏至未至是什么意思| 怕痒的男人意味着什么| 自己开店做什么赚钱| 滚刀肉是什么意思| 孩子反复发烧是什么原因| 阴茎冰凉是什么原因| 打点是什么意思| 胃胀吃什么水果| 严惩不贷是什么意思| 奇异果是什么水果| 家里适合养什么花| colombo是什么牌子| 乳头痛是什么原因| pco是什么意思| 笨和蠢有什么区别| 丹参有什么作用| 静对什么| 鲜章是什么意思| 吃什么丰胸效果好又快| 7月1号什么节| 桥字五行属什么| 胃炎吃什么药效果好| 什么什么直跳| 什么是口腔溃疡| 小气道病变是什么意思| 湿疹有什么特效药| 绿色搭配什么颜色好看| 早上五六点是什么时辰| 为的多音字是什么| 传度是什么意思| 猫头鹰吃什么| 部分导联st段改变是什么意思| 流脑是什么病| 螺旋藻是什么东西| 糖料病者应吃什么好| 鼻窦炎吃什么药效果好| 臻字五行属什么的| 湾仔码头水饺为什么贵| 什么是ph值| 送什么礼物给孩子| 6月29日什么星座| 做可乐鸡翅用什么可乐| 吃喝拉撒是什么意思| 月经流的是什么血| 9527是什么意思| 什么童话| 当今社会什么行业前途比较好| 斐乐是什么档次| 现在去贵州穿什么衣服| 盘是什么意思| 被蚂蚁咬了涂什么药| 殇读什么| au990是什么金| 宫腔积液吃什么药效果最好| 保险公司最怕什么投诉| 貂是什么动物| 劣迹斑斑是什么意思| 39什么意思| 一个月一个太念什么| 肝脏钙化灶是什么意思| redline是什么牌子| 憨笑是什么意思| 孕妇不能吃什么食物| 拉肚子吃什么药| 为什么一般不检查小肠| 什么样的伤口算开放性| 恶露是什么样子的图片| 一如既往的意思是什么| 睾酮是什么| 什么是有氧运动和无氧运动| 多囊为什么要跳绳而不是跑步| 子宫长什么样| 风寒感冒吃什么消炎药| 什么叫同工同酬| Urea医学上是什么意思| 常务副县长什么级别| 大舌头是什么意思| newear是什么牌子| 揩油什么意思| 北京有什么特产好吃| 口渴是什么病的前兆| 拉肚子是什么原因引起的| 伤情鉴定需要什么材料| 海藻酸钠是什么| 减肥吃什么药瘦得快| 属狗和什么属相不合| 七岁属什么生肖| 子宫切除后要注意什么| 孕妇感冒吃什么药| 肝炎是什么原因引起的| 什么情况下不能献血| 绯色是什么意思| ariel是什么意思| 零和博弈什么意思| 手掌小鱼际发红是什么原因| 什么枯石烂| 公安局是干什么的| 艾滋病初期有什么症状| 乌克兰和俄罗斯为什么打仗| 长痱子是什么原因| 肚脐眼为什么会有臭味| 病逝是什么意思| 从容的反义词是什么| 血氧饱和度低于90有什么危害| 黄芪有什么功效| 我会送你红色玫瑰是什么歌| 1114是什么星座| 去越南要注意什么| 什么是直女| 为什么医院不建议药流| 2月1号什么星座| 什么是直接胆红素| 为什么长痘| 间歇是什么意思| 人言可畏什么意思| 降头是什么意思| 油腔滑调指什么生肖| 盗墓笔记的结局是什么| 艾灸起水泡是什么原因| 水中毒是什么症状| 百度
    1. 7.3 Infrastructure for sequences of documents
      1. 7.3.1 Navigables
        1. 7.3.1.1 Traversable navigables
        2. 7.3.1.2 Top-level traversables
        3. 7.3.1.3 Child navigables
        4. 7.3.1.4 Jake diagrams
        5. 7.3.1.5 Related navigable collections
        6. 7.3.1.6 Navigable destruction
        7. 7.3.1.7 Navigable target names
      2. 7.3.2 Browsing contexts
        1. 7.3.2.1 Creating browsing contexts
        2. 7.3.2.2 Related browsing contexts
        3. 7.3.2.3 Groupings of browsing contexts
      3. 7.3.3 Fully active documents

7.3 Infrastructure for sequences of documents

This standard contains several related concepts for grouping sequences of documents. As a brief, non-normative summary:

Most of this standard works in the language of navigables, but certain APIs expose the existence of browsing context switches, and so some parts of the standard need to work in terms of browsing contexts.

A navigable presents a Document to the user via its active session history entry. Each navigable has:

The current session history entry and the active session history entry are usually the same, but they get out of sync when:


A navigable's active document is its active session history entry's document.

This can be safely read from within the session history traversal queue of the navigable's top-level traversable. Although a navigable's active history entry can change synchronously, the new entry will always have the same Document.

A navigable's active browsing context is its active document's browsing context. If this navigable is a traversable navigable, then its active browsing context will be a top-level browsing context.

A navigable's active WindowProxy is its active browsing context's associated WindowProxy.

A navigable's active window is its active WindowProxy's [[Window]].

This will always equal the navigable's active document's relevant global object; this is kept in sync by the make active algorithm.

A navigable's target name is its active session history entry's document state's navigable target name.


To get the node navigable of a node node, return the navigable whose active document is node's node document, or null if there is no such navigable.


To initialize the navigable navigable navigable, given a document state documentState and an optional navigable-or-null parent (default null):

  1. Assert: documentState's document is non-null.

  2. Let entry be a new session history entry, with

    URL
    documentState's document's URL
    document state
    documentState

    The caller of this algorithm is responsible for initializing entry's step; it will be left as "pending" until that is complete.

  3. Set navigable's current session history entry to entry.

  4. Set navigable's active session history entry to entry.

  5. Set navigable's parent to parent.

7.3.1.1 Traversable navigables

A traversable navigable is a navigable that also controls which session history entry should be the current session history entry and active session history entry for itself and its descendant navigables.

In addition to the properties of a navigable, a traversable navigable has:

To get the traversable navigable of a navigable inputNavigable:

  1. Let navigable be inputNavigable.

  2. While navigable is not a traversable navigable, set navigable to navigable's parent.

  3. Return navigable.

7.3.1.2 Top-level traversables

A top-level traversable is a traversable navigable with a null parent.

Currently, all traversable navigables are top-level traversables. Future proposals envision introducing non-top-level traversables.

A user agent holds a top-level traversable set (a set of top-level traversables). These are typically presented to the user in the form of browser windows or browser tabs.

To get the top-level traversable of a navigable inputNavigable:

  1. Let navigable be inputNavigable.

  2. While navigable's parent is not null, set navigable to navigable's parent.

  3. Return navigable.

To create a new top-level traversable given a browsing context-or-null opener, a string targetName, and an optional navigable openerNavigableForWebDriver:

  1. Let document be null.

  2. If opener is null, then set document to the second return value of creating a new top-level browsing context and document.

  3. Otherwise, set document to the second return value of creating a new auxiliary browsing context and document given opener.

  4. Let documentState be a new document state, with

    document
    document
    initiator origin
    null if opener is null; otherwise, document's origin
    origin
    document's origin
    navigable target name
    targetName
    about base URL
    document's about base URL
  5. Let traversable be a new traversable navigable.

  6. Initialize the navigable traversable given documentState.

  7. Let initialHistoryEntry be traversable's active session history entry.

  8. Set initialHistoryEntry's step to 0.

  9. Append initialHistoryEntry to traversable's session history entries.

  10. If opener is non-null, then legacy-clone a traversable storage shed given opener's top-level traversable and traversable. [STORAGE]

  11. Append traversable to the user agent's top-level traversable set.

  12. Invoke WebDriver BiDi navigable created with traversable and openerNavigableForWebDriver.

  13. Return traversable.

To create a fresh top-level traversable given a URL initialNavigationURL and an optional POST resource-or-null initialNavigationPostResource (default null):

  1. Let traversable be the result of creating a new top-level traversable given null and the empty string.

  2. Navigate traversable to initialNavigationURL using traversable's active document, with documentResource set to initialNavigationPostResource.

    We treat these initial navigations as traversable navigating itself, which will ensure all relevant security checks pass.

  3. Return traversable.

7.3.1.3 Child navigables

Certain elements (for example, iframe elements) can present a navigable to the user. These elements are called navigable containers.

Each navigable container has a content navigable, which is either a navigable or null. It is initially null.

The container of a navigable navigable is the navigable container whose content navigable is navigable, or null if there is no such element.

The container document of a navigable navigable is the result of running these steps:

  1. If navigable's container is null, then return null.

  2. Return navigable's container's node document.

    This is equal to navigable's container's shadow-including root as navigable's container has to be connected.

The container document of a Document document is the result of running these steps:

  1. If document's node navigable is null, then return null.

  2. Return document's node navigable's container document.

A navigable navigable is a child navigable of another navigable potentialParent when navigable's parent is potentialParent. We can also just say that a navigable "is a child navigable", which means that its parent is non-null.

All child navigables are the content navigable of their container.

The content document of a navigable container container is the result of running these steps:

  1. If container's content navigable is null, then return null.

  2. Let document be container's content navigable's active document.

  3. If document's origin and container's node document's origin are not same origin-domain, then return null.

  4. Return document.

The content window of a navigable container container is the result of running these steps:

  1. If container's content navigable is null, then return null.

  2. Return container's content navigable's active WindowProxy's object.


To create a new child navigable, given an element element:

  1. Let parentNavigable be element's node navigable.

  2. Let group be element's node document's browsing context's top-level browsing context's group.

  3. Let browsingContext and document be the result of creating a new browsing context and document given element's node document, element, and group.

  4. Let targetName be null.

  5. If element has a name content attribute, then set targetName to the value of that attribute.

  6. Let documentState be a new document state, with

    document
    document
    initiator origin
    document's origin
    origin
    document's origin
    navigable target name
    targetName
    about base URL
    document's about base URL
  7. Let navigable be a new navigable.

  8. Initialize the navigable navigable given documentState and parentNavigable.

  9. Set element's content navigable to navigable.

  10. Let historyEntry be navigable's active session history entry.

  11. Let traversable be parentNavigable's traversable navigable.

  12. Append the following session history traversal steps to traversable:

    1. Let parentDocState be parentNavigable's active session history entry's document state.

    2. Let parentNavigableEntries be the result of getting session history entries for parentNavigable.

    3. Let targetStepSHE be the first session history entry in parentNavigableEntries whose document state equals parentDocState.

    4. Set historyEntry's step to targetStepSHE's step.

    5. Let nestedHistory be a new nested history whose id is navigable's id and entries list is ? historyEntry ?.

    6. Append nestedHistory to parentDocState's nested histories.

    7. Update for navigable creation/destruction given traversable.

  13. Invoke WebDriver BiDi navigable created with traversable.

7.3.1.4 Jake diagrams

A useful method for visualizing sequences of documents, and in particular navigables and their session history entries, is the Jake diagram. A typical Jake diagram is the following:

01234
top/t-a/t-a#foo/t-b
frames[0]/i-0-a/i-0-b
frames[1]/i-1-a/i-1-b

Here, each numbered column denotes a possible value for the traversable's session history step. Each labeled row depicts a navigable, as it transitions between different URLs and documents. The first, labeled top, being the top-level traversable, and the others being child navigables. The documents are given by the background color of each cell, with a new background color indicating a new document in that navigable. The URLs are given by the text content of the cells; usually they are given as relative URLs for brevity, unless a cross-origin case is specifically under investigation. A given navigable might not exist at a given step, in which case the corresponding cells are empty. The bold-italic step number depicts the current session history step of the traversable, and all cells with bold-italic URLs represent the current session history entry for that row's navigable.

Thus, the above Jake diagram depicts the following sequence of events:

  1. A top-level traversable is created, starting at the URL /t-a, with two child navigables starting at /i-0-a and /i-1-a respectively.

  2. The first child navigable is navigated to another document, with URL /i-0-b.

  3. The second child navigable is navigated to another document, with URL /i-1-b.

  4. The top-level traversable is navigated to the same document, updating its URL to /t-a#foo.

  5. The top-level traversable is navigated to another document, with URL /t-b. (Notice how this document, of course, does not carry over the old document's child navigables.)

  6. The traversable was traversed by a delta of ?3, back to step 1.

Jake diagrams are a powerful tool for visualizing the interactions of multiple navigables, navigations, and traversals. They cannot capture every possible interaction — for example, they only work with a single level of nesting — but we will have ocassion to use them to illustrate several complex situations throughout this standard.

Jake diagrams are named after their creator, the inimitable Jake Archibald.

It is often helpful in this standard's algorithms to look at collections of navigables starting at a given Document. This section contains a curated set of algorithms for collecting those navigables.

The return values of these algorithms are ordered so that parents appears before their children. Callers rely on this ordering.

Starting with a Document, rather than a navigable, is generally better because it makes the caller cognizant of whether they are starting with a fully active Document or not. Although non-fully active Documents do have ancestor and descendant navigables, they often behave as if they don't (e.g., in the window.parent getter).

The ancestor navigables of a Document document are given by these steps:

  1. Let navigable be document's node navigable's parent.

  2. Let ancestors be an empty list.

  3. While navigable is not null:

    1. Prepend navigable to ancestors.

    2. Set navigable to navigable's parent.

  4. Return ancestors.

The inclusive ancestor navigables of a Document document are given by these steps:

  1. Let navigables be document's ancestor navigables.

  2. Append document's node navigable to navigables.

  3. Return navigables.

The descendant navigables of a Document document are given by these steps:

  1. Let navigables be new list.

  2. Let navigableContainers be a list of all shadow-including descendants of document that are navigable containers, in shadow-including tree order.

  3. For each navigableContainer of navigableContainers:

    1. If navigableContainer's content navigable is null, then continue.

    2. Extend navigables with navigableContainer's content navigable's active document's inclusive descendant navigables.

  4. Return navigables.

The inclusive descendant navigables of a Document document are given by these steps:

  1. Let navigables be ? document's node navigable ?.

  2. Extend navigables with document's descendant navigables.

  3. Return navigables.

These descendant-collecting algorithms are described as looking at the DOM tree of descendant Document objects. In reality, this is often not feasible since the DOM tree can be in another process from the caller of the algorithm. Instead, implementations generally replicate the appropriate trees across processes.

The document-tree child navigables of a Document document are given by these steps:

  1. If document's node navigable is null, then return the empty list.

  2. Let navigables be new list.

  3. Let navigableContainers be a list of all descendants of document that are navigable containers, in tree order.

  4. For each navigableContainer of navigableContainers:

    1. If navigableContainer's content navigable is null, then continue.

    2. Append navigableContainer's content navigable to navigables.

  5. Return navigables.

7.3.1.6 Navigable destruction

To destroy a child navigable given a navigable container container:

  1. Let navigable be container's content navigable.

  2. If navigable is null, then return.

  3. Set container's content navigable to null.

  4. Inform the navigation API about child navigable destruction given navigable.

  5. Destroy a document and its descendants given navigable's active document.

  6. Let parentDocState be container's node navigable's active session history entry's document state.

  7. Remove the nested history from parentDocState's nested histories whose id equals navigable's id.

  8. Let traversable be container's node navigable's traversable navigable.

  9. Append the following session history traversal steps to traversable:

    1. Update for navigable creation/destruction given traversable.

  10. Invoke WebDriver BiDi navigable destroyed with navigable.

To destroy a top-level traversable traversable:

  1. Let browsingContext be traversable's active browsing context.

  2. For each historyEntry in traversable's session history entries in what order?:

    1. Let document be historyEntry's document.

    2. If document is not null, then destroy a document and its descendants given document.

  3. Remove browsingContext.

  4. Remove traversable from the user interface (e.g., close or hide its tab in a tabbed browser).

  5. Remove traversable from the user agent's top-level traversable set.

  6. Invoke WebDriver BiDi navigable destroyed with traversable.

User agents may destroy a top-level traversable at any time (typically, in response to user requests).

To close a top-level traversable traversable:

  1. If traversable's is closing is true, then return.

  2. Definitely close traversable.

To definitely close a top-level traversable traversable:

  1. Let toUnload be traversable's active document's inclusive descendant navigables.

  2. If the result of checking if unloading is canceled for toUnload is not "continue", then return.

  3. Append the following session history traversal steps to traversable:

    1. Let afterAllUnloads be an algorithm step which destroys traversable.

    2. Unload a document and its descendants given traversable's active document, null, and afterAllUnloads.

The close vs. definitely close separation allows other specifications to call close and have it be a no-op if the top-level traversable is already closing due to JavaScript code calling window.close().

Navigables can be given target names, which are strings allowing certain APIs (such as window.open() or the a element's target attribute) to target navigations at that navigable.

A valid navigable target name is any string with at least one character that does not contain both an ASCII tab or newline and a U+003C (<), and it does not start with a U+005F (_). (Names starting with a U+005F (_) are reserved for special keywords.)

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

These values have different meanings based on whether the page is sandboxed or not, as summarized in the following (non-normative) table. In this table, "current" means the navigable that the link or script is in, "parent" means the parent of the navigable that the link or script is in, "top" means the top-level traversable of the navigable that the link or script is in, "new" means a new traversable navigable with a null parent (which may use an auxiliary browsing context, subject to various user preferences and user agent policies), "none" means that nothing will happen, and "maybe new" means the same as "new" if the "allow-popups" keyword is also specified on the sandbox attribute (or if the user overrode the sandboxing), and the same as "none" otherwise.

Keyword Ordinary effect Effect in an iframe with...
sandbox="" sandbox="allow-top-navigation"
none specified, for links and form submissions current current current
empty string current current current
_blank new maybe new maybe new
_self current current current
_parent if there isn't a parent current current current
_parent if parent is also top parent/top none parent/top
_parent if there is one and it's not top parent none none
_top if top is current current current current
_top if top is not current top none top
name that doesn't exist new maybe new maybe new
name that exists and is a descendant specified descendant specified descendant specified descendant
name that exists and is current current current current
name that exists and is an ancestor that is top specified ancestor none specified ancestor/top
name that exists and is an ancestor that is not top specified ancestor none none
other name that exists with common top specified none none
name that exists with different top, if familiar and one permitted sandboxed navigator specified specified specified
name that exists with different top, if familiar but not one permitted sandboxed navigator specified none none
name that exists with different top, not familiar new maybe new maybe new

Most of the restrictions on sandboxed browsing contexts are applied by other algorithms, e.g. the navigation algorithm, not the rules for choosing a navigable given below.


To find a navigable by target name given a string name and a navigable currentNavigable:

  1. Let currentDocument be currentNavigable's active document.

  2. Let sourceSnapshotParams be the result of snapshotting source snapshot params given currentDocument.

  3. Let subtreesToSearch be an implementation-defined choice of one of the following:

    Issue #10848 tracks settling on one of these two possibilities, to achieve interoperability.

  4. For each subtreeToSearch of subtreesToSearch, in reverse order:

    1. Let documentToSearch be subtreeToSearch's active document.

    2. For each navigable of the inclusive descendant navigables of documentToSearch:

      1. If currentNavigable is not allowed by sandboxing to navigate navigable given sourceSnapshotParams, then optionally continue.

        Issue #10849 tracks making this check required, to achieve interoperability.

      2. If navigable's target name is name, then return navigable.

  5. Let currentTopLevelBrowsingContext be currentNavigable's active browsing context's top-level browsing context.

  6. Let group be currentTopLevelBrowsingContext's group.

  7. For each topLevelBrowsingContext of group's browsing context set, in an implementation-defined order (the user agent should pick a consistent ordering, such as the most recently opened, most recently focused, or more closely related):

    Issue #10850 tracks picking a specific ordering, to achieve interoperability.

    1. If currentTopLevelBrowsingContext is topLevelBrowsingContext, then continue.

    2. Let documentToSearch be topLevelBrowsingContext's active document.

    3. For each navigable of the inclusive descendant navigables of documentToSearch:

      1. If currentNavigable's active browsing context is not familiar with navigable's active browsing context, then continue.

      2. If currentNavigable is not allowed by sandboxing to navigate navigable given sourceSnapshotParams, then optionally continue.

        Issue #10849 tracks making this check required, to achieve interoperability.

      3. If navigable's target name is name, then return navigable.

  8. Return null.

The rules for choosing a navigable, given a string name, a navigable currentNavigable, and a boolean noopener are as follows:

  1. Let chosen be null.

  2. Let windowType be "existing or none".

  3. Let sandboxingFlagSet be currentNavigable's active document's active sandboxing flag set.

  4. If name is the empty string or an ASCII case-insensitive match for "_self", then set chosen to currentNavigable.

  5. Otherwise, if name is an ASCII case-insensitive match for "_parent", set chosen to currentNavigable's parent, if any, and currentNavigable otherwise.

  6. Otherwise, if name is an ASCII case-insensitive match for "_top", set chosen to currentNavigable's traversable navigable.

  7. Otherwise, if name is not an ASCII case-insensitive match for "_blank" and noopener is false, then set chosen to the result of finding a navigable by target name given name and currentNavigable.

  8. If chosen is null, then a new top-level traversable is being requested, and what happens depends on the user agent's configuration and abilities — it is determined by the rules given for the first applicable option from the following list:

    The user agent may inform the user that a popup has been blocked.

    If sandboxingFlagSet has the sandboxed auxiliary navigation browsing context flag set

    The user agent may report to a developer console that a popup has been blocked.

    If the user agent has been configured such that in this instance it will create a new top-level traversable
    1. Consume user activation of currentNavigable's active window.

    2. Set windowType to "new and unrestricted".

    3. Let currentDocument be currentNavigable's active document.

    4. If currentDocument's opener policy's value is "same-origin" or "same-origin-plus-COEP", and currentDocument's origin is not same origin with currentDocument's relevant settings object's top-level origin, then:

      1. Set noopener to true.

      2. Set name to "_blank".

      3. Set windowType to "new with no opener".

      In the presence of an opener policy, nested documents that are cross-origin with their top-level browsing context's active document always set noopener to true.

    5. Let targetName be the empty string.

    6. If name is not an ASCII case-insensitive match for "_blank", then set targetName to name.

    7. If noopener is true, then set chosen to the result of creating a new top-level traversable given null, targetName, and currentNavigable.

    8. Otherwise:

      1. Set chosen to the result of creating a new top-level traversable given currentNavigable's active browsing context, targetName, and currentNavigable.

      2. If sandboxingFlagSet's sandboxed navigation browsing context flag is set, then set chosen's active browsing context's one permitted sandboxed navigator to currentNavigable's active browsing context.

    9. If sandboxingFlagSet's sandbox propagates to auxiliary browsing contexts flag is set, then all the flags that are set in sandboxingFlagSet must be set in chosen's active browsing context's popup sandboxing flag set.

    10. Set chosen's is created by web content to true.

    If the newly created navigable chosen is immediately navigated, then the navigation will be done as a "replace" navigation.

    If the user agent has been configured such that in this instance it will choose currentNavigable

    Set chosen to currentNavigable.

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

    Do nothing.

    User agents are encouraged to provide a way for users to configure the user agent to always choose currentNavigable.

  9. Return chosen and windowType.

7.3.2 Browsing contexts

A browsing context is a programmatic representation of a series of documents, multiple of which can live within a single navigable. Each browsing context has a corresponding WindowProxy object, as well as the following:

A browsing context's active window is its WindowProxy object's [[Window]] internal slot value. A browsing context's active document is its active window's associated Document.

A browsing context's top-level traversable is its active document's node navigable's top-level traversable.

A browsing context whose is auxiliary is true is known as an auxiliary browsing context. Auxiliary browsing contexts are always top-level browsing contexts.

It's unclear whether a separate is auxiliary concept is necessary. In issue #5680, it is indicated that we may be able to simplify this by using whether or not the opener browsing context is null.

Modern specifications should avoid using the browsing context concept in most cases, unless they are dealing with the subtleties of browsing context group switches and agent cluster allocation. Instead, the Document and navigable concepts are usually more appropriate.


A Document's browsing context is a browsing context or null, initially null.

A Document does not necessarily have a non-null browsing context. In particular, data mining tools are likely to never instantiate browsing contexts. A Document created using an API such as createDocument() never has a non-null browsing context. And the Document originally created for an iframe element, which has since been removed from the document, has no associated browsing context, since that browsing context was nulled out.

In general, there is a 1-to-1 mapping from the Window object to the Document object, as long as the Document object has a non-null browsing context. There is one exception. A Window can be reused for the presentation of a second Document in the same browsing context, such that the mapping is then 1-to-2. This occurs when a browsing context is navigated from the initial about:blank Document to another, which will be done with replacement.

7.3.2.1 Creating browsing contexts

To create a new browsing context and document, given null or a Document object creator, null or an element embedder, and a browsing context group group:

  1. Let browsingContext be a new browsing context.

  2. Let unsafeContextCreationTime be the unsafe shared current time.

  3. Let creatorOrigin be null.

  4. Let creatorBaseURL be null.

  5. If creator is non-null, then:

    1. Set creatorOrigin to creator's origin.

    2. Set creatorBaseURL to creator's document base URL.

    3. Set browsingContext's virtual browsing context group ID to creator's browsing context's top-level browsing context's virtual browsing context group ID.

  6. Let sandboxFlags be the result of determining the creation sandboxing flags given browsingContext and embedder.

  7. Let origin be the result of determining the origin given about:blank, sandboxFlags, and creatorOrigin.

  8. Let permissionsPolicy be the result of creating a permissions policy given embedder and origin. [PERMISSIONSPOLICY]

  9. Let agent be the result of obtaining a similar-origin window agent given origin, group, and false.

  10. Let realm execution context be the result of creating a new realm given agent and the following customizations:

  11. Let topLevelCreationURL be about:blank if embedder is null; otherwise embedder's relevant settings object's top-level creation URL.

  12. Let topLevelOrigin be origin if embedder is null; otherwise embedder's relevant settings object's top-level origin.

  13. Set up a window environment settings object with about:blank, realm execution context, null, topLevelCreationURL, and topLevelOrigin.

  14. Let loadTimingInfo be a new document load timing info with its navigation start time set to the result of calling coarsen time with unsafeContextCreationTime and the new environment settings object's cross-origin isolated capability.

  15. Let document be a new Document, with:

    type
    "html"
    content type
    "text/html"
    mode
    "quirks"
    origin
    origin
    browsing context
    browsingContext
    permissions policy
    permissionsPolicy
    active sandboxing flag set
    sandboxFlags
    load timing info
    loadTimingInfo
    is initial about:blank
    true
    about base URL
    creatorBaseURL
    allow declarative shadow roots
    true
    custom element registry
    a new CustomElementRegistry object
  16. If creator is non-null, then:

    1. Set document's referrer to the serialization of creator's URL.

    2. Set document's policy container to a clone of creator's policy container.

    3. If creator's origin is same origin with creator's relevant settings object's top-level origin, then set document's opener policy to creator's browsing context's top-level browsing context's active document's opener policy.

  17. Assert: document's URL and document's relevant settings object's creation URL are about:blank.

  18. Mark document as ready for post-load tasks.

  19. Populate with html/head/body given document.

  20. Make active document.

  21. Completely finish loading document.

  22. Return browsingContext and document.

To create a new top-level browsing context and document:

  1. Let group and document be the result of creating a new browsing context group and document.

  2. Return group's browsing context set[0] and document.

To create a new auxiliary browsing context and document, given a browsing context opener:

  1. Let openerTopLevelBrowsingContext be opener's top-level traversable's active browsing context.

  2. Let group be openerTopLevelBrowsingContext's group.

  3. Assert: group is non-null, as navigating invokes this directly.

  4. Let browsingContext and document be the result of creating a new browsing context and document with opener's active document, null, and group.

  5. Set browsingContext's is auxiliary to true.

  6. Append browsingContext to group.

  7. Set browsingContext's opener browsing context to opener.

  8. Set browsingContext's virtual browsing context group ID to openerTopLevelBrowsingContext's virtual browsing context group ID.

  9. Set browsingContext's opener origin at creation to opener's active document's origin.

  10. Return browsingContext and document.

To determine the origin, given a URL url, a sandboxing flag set sandboxFlags, and an origin-or-null sourceOrigin:

  1. If sandboxFlags has its sandboxed origin browsing context flag set, then return a new opaque origin.

  2. If url is null, then return a new opaque origin.

  3. If url is about:srcdoc, then:

    1. Assert: sourceOrigin is non-null.

    2. Return sourceOrigin.

  4. If url matches about:blank and sourceOrigin is non-null, then return sourceOrigin.

  5. Return url's origin.

The cases that return sourceOrigin result in two Documents that end up with the same underlying origin, meaning that document.domain affects both.

7.3.2.2 Related browsing contexts

A browsing context potentialDescendant is said to be an ancestor of a browsing context potentialAncestor if the following algorithm returns true:

  1. Let potentialDescendantDocument be potentialDescendant's active document.

  2. If potentialDescendantDocument is not fully active, then return false.

  3. Let ancestorBCs be the list obtained by taking the browsing context of the active document of each member of potentialDescendantDocument's ancestor navigables.

  4. If ancestorBCs contains potentialAncestor, then return true.

  5. Return false.

A top-level browsing context is a browsing context whose active document's node navigable is a traversable navigable.

It is not required to be a top-level traversable.

The top-level browsing context of a browsing context start is the result of the following algorithm:

  1. If start's active document is not fully active, then return null.

  2. Let navigable be start's active document's node navigable.

  3. While navigable's parent is not null, set navigable to navigable's parent.

  4. Return navigable's active browsing context.


A browsing context A is familiar with a second browsing context B if the following algorithm returns true:

  1. If A's active document's origin is same origin with B's active document's origin, then return true.

  2. If A's top-level browsing context is B, then return true.

  3. If B is an auxiliary browsing context and A is familiar with B's opener browsing context, then return true.

  4. If there exists an ancestor browsing context of B whose active document has the same origin as the active document of A, then return true.

    This includes the case where A is an ancestor browsing context of B.

  5. Return false.

7.3.2.3 Groupings of browsing contexts

A top-level browsing context has an associated group (null or a browsing context group). It is initially null.

A user agent holds a browsing context group set (a set of browsing context groups).

A browsing context group holds a browsing context set (a set of top-level browsing contexts).

A top-level browsing context is added to the group when the group is created. All subsequent top-level browsing contexts added to the group will be auxiliary browsing contexts.

A browsing context group has an associated agent cluster map (a weak map of agent cluster keys to agent clusters). User agents are responsible for collecting agent clusters when it is deemed that nothing can access them anymore.

A browsing context group has an associated historical agent cluster key map, which is a map of origins to agent cluster keys. This map is used to ensure the consistency of the origin-keyed agent clusters feature by recording what agent cluster keys were previously used for a given origin.

The historical agent cluster key map only ever gains entries over the lifetime of the browsing context group.

A browsing context group has a cross-origin isolation mode, which is a cross-origin isolation mode. It is initially "none".

A cross-origin isolation mode is one of three possible values: "none", "logical", or "concrete".

"logical" and "concrete" are similar. They are both used for browsing context groups where:

On some platforms, it is difficult to provide the security properties required to grant safe access to the APIs gated by the cross-origin isolated capability. As a result, only "concrete" can grant access that capability. "logical" is used on platform not supporting this capability, where various restrictions imposed by cross-origin isolation will still apply, but the capability is not granted.

To create a new browsing context group and document:

  1. Let group be a new browsing context group.

  2. Append group to the user agent's browsing context group set.

  3. Let browsingContext and document be the result of creating a new browsing context and document with null, null, and group.

  4. Append browsingContext to group.

  5. Return group and document.

To append a top-level browsing context browsingContext to a browsing context group group:

  1. Append browsingContext to group's browsing context set.

  2. Set browsingContext's group to group.

To remove a top-level browsing context browsingContext:

  1. Assert: browsingContext's group is non-null.

  2. Let group be browsingContext's group.

  3. Set browsingContext's group to null.

  4. Remove browsingContext from group's browsing context set.

  5. If group's browsing context set is empty, then remove group from the user agent's browsing context group set.

Append and remove are primitive operations that help define the lifetime of a browsing context group. They are called by higher-level creation and destruction operations for Documents and browsing contexts.

When there are no Document objects whose browsing context equals a given browsing context (i.e., all such Documents have been destroyed), and that browsing context's WindowProxy is eligible for garbage collection, then the browsing context will never be accessed again. If it is a top-level browsing context, then at this point the user agent must remove it.

7.3.3 Fully active documents

A Document d is said to be fully active when d is the active document of a navigable navigable, and either navigable is a top-level traversable or navigable's container document is fully active.

Because they are associated with an element, child navigables are always tied to a specific Document, their container document, in their parent navigable. User agents must not allow the user to interact with child navigables whose container documents are not themselves fully active.

The following example illustrates how a Document can be the active document of its node navigable, while not being fully active. Here a.html is loaded into a browser window, b-1.html starts out loaded into an iframe as shown, and b-2.html and c.html are omitted (they can simply be an empty document).

<!-- a.html -->
<!DOCTYPE html>
<html lang="en">
<title>Navigable A</title>

<iframe src="b-1.html"></iframe>
<button onclick="frames[0].location.href = 'b-2.html'">Click me</button>

<!-- b-1.html -->
<!DOCTYPE html>
<html lang="en">
<title>Navigable B</title>

<iframe src="c.html"></iframe>

At this point, the documents given by a.html, b-1.html, and c.html are all the active documents of their respective node navigables. They are also all fully active.

After clicking on the button, and thus loading a new Document from b-2.html into navigable B, we have the following results:

百度