Edition for Web Developers — Last Updated 12 May 2025
Window
オブジェクトSupport in all current engines.
window.window
window.frames
window.self
これらの属性はすべてwindowを返す。
window.document
windowと関連するDocument
を返す。
document.defaultView
documentに関連付けられたWindow
がある場合はそれを返し、そうでなければnullを返す。
window = window.open([ url [, target [, features ] ] ])
url(デフォルトで"about:blank
")を表示するためのウィンドウを開き、それを返す。target(デフォルトで"_blank
")は、新しいウィンドウの名前を示す。すでにその名前をもつウィンドウが存在する場合、それが再利用される。features引数はコンマ区切りトークンの集合を含むことができる:
noopener
"noreferrer
"これらは、ハイパーリンク上のnoopener
およびnoreferrer
リンクタイプと同等に動作する。
popup
"ユーザーエージェントに、新しいウィンドウに最小限のウェブブラウザーユーザーインターフェイスを提供するように促す。 (すべてのBarProp
オブジェクトにもvisible
ゲッターに影響を与える。)
globalThis. open( "https://email.example/message/CAOOOkFcWW97r8yg=SsWg7GgCmp4suVX9o85y8BvNRqMjuc5PXg" , undefined , "noopener,popup" );
window.name [ = value ]
ウィンドウの名前を返す。
名前を変更する設定が可能である。
window.close()
ウィンドウを閉じる。
window.closed
ウィンドウが閉じられている場合はtrueを返し、そうでなければfalseを返す。
window.stop()
ドキュメントの読み込みを中止する。
Window
オブジェクトのインデックス付きアクセスwindow.length
文書ツリーの子ナビゲート可能の数を返す。
window[index]
指定された文書ツリーの子ナビゲート可能に対応するWindowProxy
を返す。
Window
オブジェクトの名前付きアクセスwindow[name]
指示された要素または要素のコレクションを返す。
一般的な規則として、これに依存することはもろいコードを導く。たとえば、新しい機能がウェブプラットフォームに加えられるように、いずれかのIDがこのAPIのマッピングで終わることは時間をかけて変化できる。この代わりに、document.getElementById()
またはdocument.querySelector()
を使用する。
window.top
window.opener [ = value ]
オープナーブラウジングコンテキストに対するWindowProxy
を返す。
存在しないまたはnullが設定されている場合、nullを返す。
nullに設定可能である。
window.parent
親ナビゲート可能に対するWindowProxy
を返す。
window.frameElement
ナビゲート可能コンテナー要素を返す。
存在しない場合、生成元をまたいだ状況でnullを返す。
歴史的な理由から、Window
インターフェイスには、特定のウェブブラウザーインターフェイス要素の可視性を表すいくつかのプロパティがあった。
プライバシーと相互運用性の理由から、ウィンドウがポップアップウィンドウを表しているかどうかに関係なく、これらのプロパティはすべて同じ値を返すようになった。
window.locationbar.visible
Support in all current engines.
window.
.visiblewindow.personalbar.visible
window.scrollbars.visible
window.statusbar.visible
window.toolbar.visible
Window
がポップアップでない場合はtrueを返す。そうでなければfalseを返す。
WindowProxy
外来オブジェクトWindowProxy
は、Window
の通常のオブジェクトをラップする外来オブジェクトであり、ほとんどの操作をラップされたオブジェクトに間接的に転送する。各ブラウジングコンテキストは、関連するWindowProxy
オブジェクトを持つ。ブラウジングコンテキストがナビゲートされるとき、ブラウジングコンテキストの関連付けられたWindowProxy
オブジェクトによってラップされたWindow
オブジェクトが変更される。
Location
インターフェイスSupport in all current engines.
Support in all current engines.
Support in all current engines.
各Window
オブジェクトは、Location
オブジェクトの一意なインスタンスに関連付けられており、Window
オブジェクトの作成時に割り当てられる。
document.location [ = value ]
window.location [ = value ]
現在のページの位置とLocation
オブジェクトを返す。
別のページにナビゲートするために、設定可能である。
Location
オブジェクトは、関連付けられたDocument
のURLの表現と、関連付けられたナビゲート可能をナビゲートおよびリロードするためのメソッドを提供する。
location.toString()
location.href
Location
オブジェクトのURLを返す。
与えられたURLにナビゲートするように、設定可能である。
location.origin
Location
オブジェクトの生成元を返す。
location.protocol
Location
オブジェクトのスキームを返す。
変更されたスキームと同じURLにナビゲートするように、設定可能である。
location.host
Location
オブジェクトのURLのホストとポートを返す(スキームのデフォルトポートと異なる場合)。
変更されたホストおよびポートと同じURLにナビゲートするように、設定可能である。
location.hostname
Location
オブジェクトのホストを返す。
変更されたホストと同じURLにナビゲートするように、設定可能である。
location.port
Location
オブジェクトのポートを返す。
変更されたポートと同じURLにナビゲートするように、設定可能である。
location.pathname
Location
オブジェクトのパスを返す。
変更されたパスと同じURLにナビゲートするように、設定可能である。
location.search
Location
オブジェクトのURLのクエリーを返す(空でない場合は先頭の"?
"を含む)。
(先頭の"?
"を無視して)変更されたクエリーと同じURLにナビゲートするように、設定可能である。
location.hash
Location
オブジェクトのURLのフラグメントを返す(空でない場合は先頭の"#
"を含む)。
(先頭の"#
"を無視して)変更されたフラグメントと同じURLにナビゲートするように、設定可能である。
location.assign(url)
与えられたURLにナビゲートする。
location.replace(url)
セッション履歴から現在のページを削除し、与えられたURLにナビゲートする。
location.reload()
現在のページをリロードする。
location.ancestorOrigins
History
インターフェイスSupport in all current engines.
Support in all current engines.
history.length
現在のトラバース可能なナビゲート可能の全体のセッション履歴エントリーの数を返す。
history.scrollRestoration
history.scrollRestoration = value
アクティブなセッション履歴エントリーのスクロール復元モードをvalueに設定する。
history.state
アクティブなセッション履歴エントリーのクラシック履歴API状態を、JavaScript値にデシリアライズして返す。
history.go()
現在のページをリロードする。
history.go(delta)
現在のトラバース可能なナビゲート可能の全体のセッション履歴エントリーリストで、指定された数のステップを前後に移動する。
ゼロ差分は、現在のページをリロードする。
差分が範囲外の場合、何もしない。
history.back()
現在のトラバース可能なナビゲート可能の全体のセッション履歴エントリーリストで1ステップ戻る。
前のページが存在しない場合、何もしない。
history.forward()
現在のトラバース可能なナビゲート可能の全体のセッション履歴エントリーリストで1ステップ進める。
次のページが存在しない場合、何もしない。
history.pushState(data, "")
クラシック履歴API状態をデータのシリアル化に設定して、セッション履歴に新しいエントリーを追加する。アクティブな履歴エントリーのURLがコピーされ、新しいエントリーのURLに使用される。
(2番目のパラメーターは歴史的な理由で存在し、省略することはできない。空の文字列を渡すことは慣例的なものである。)
history.pushState(data, "", url)
クラシック履歴API状態をデータのシリアル化に設定し、 URLをurlに設定して、セッション履歴に新しいエントリーを追加する。
現在のDocument
がURLをurlに書き換えることができない場合、"SecurityError
" DOMException
が投げられる。
(2番目のパラメーターは歴史的な理由で存在し、省略することはできない。空の文字列を渡すことは慣例的なものである。)
history.replaceState(data, "")
アクティブセッション履歴エントリーのクラシック履歴API状態を、 データの構造化クローンに更新する。
(2番目のパラメーターは歴史的な理由で存在し、省略することはできない。空の文字列を渡すことは慣例的なものである。)
history.replaceState(data, "", url)
アクティブなセッション履歴エントリーのクラシック履歴API状態を データの構造化クローンに更新し、そのURLをurlに更新する。
現在のDocument
がURLをurlに書き換えることができない場合、"SecurityError
" DOMException
が投げられる。
(2番目のパラメーターは歴史的な理由で存在し、省略することはできない。空の文字列を渡すことは慣例的なものである。)
document's URL | targetURL | can have its URL rewritten |
---|---|---|
https://example.com/home | https://example.com/home#about | ✅ |
https://example.com/home | https://example.com/home?page=shop | ✅ |
https://example.com/home | https://example.com/shop | ✅ |
https://example.com/home | https://user:pass@example.com/home | ❌ |
https://example.com/home | http://example.com/home | ❌ |
file:///path/to/x | file:///path/to/x#hash | ✅ |
file:///path/to/x | file:///path/to/x?search | ✅ |
file:///path/to/x | file:///path/to/y | ❌ |
about:blank | about:blank#hash | ✅ |
about:blank | about:blank?search | ❌ |
about:blank | about:srcdoc | ❌ |
data:text/html,foo | data:text/html,foo#hash | ✅ |
data:text/html,foo | data:text/html,foo?search | ❌ |
data:text/html,foo | data:text/html,bar | ❌ |
data:text/html,foo | data:bar | ❌ |
blob:https://example.com/77becafe-657b-4fdc-8bd3-e83aaa5e8f43 | blob:https://example.com/77becafe-657b-4fdc-8bd3-e83aaa5e8f43#hash | ✅ |
blob:https://example.com/77becafe-657b-4fdc-8bd3-e83aaa5e8f43 | blob:https://example.com/77becafe-657b-4fdc-8bd3-e83aaa5e8f43?search | ❌ |
blob:https://example.com/77becafe-657b-4fdc-8bd3-e83aaa5e8f43 | blob:https://example.com/anything | ❌ |
blob:https://example.com/77becafe-657b-4fdc-8bd3-e83aaa5e8f43 | blob:path | ❌ |
Document
のURLのみが重要であり、その生成元は重要ではないことに注意する。継承された生成元をもつabout:blank
Document
、サンフォボックスiframe
、またはdocument.domain
セッターが使用されている場合のように、これらが一致しないことがある。
ユーザーはいくつかの座標に常にあり、ユーザーが後で再開するための特定の座標に対応するページをブックマークできるような、ユーザーがラインに沿って移動できるゲームを考える。
そのようなゲームでx=5位置を実装する静的ページは次のようになる:
<!DOCTYPE HTML>
<!-- this is https://example.com/line?x=5 -->
< html lang = "en" >
< title > Line Game - 5</ title >
< p > You are at coordinate 5 on the line.</ p >
< p >
< a href = "?x=6" > Advance to 6</ a > or
< a href = "?x=4" > retreat to 4</ a > ?
</ p >
このようなシステムの問題点は、毎回ユーザーがクリックするとページ全体をリロードする必要があることにある。ここで、代わりにスクリプトを使用して、リロードを行うための別の方法:
<!DOCTYPE HTML>
<!-- this starts off as https://example.com/line?x=5 -->
< html lang = "en" >
< title > Line Game - 5</ title >
< p > You are at coordinate < span id = "coord" > 5</ span > on the line.</ p >
< p >
< a href = "?x=6" onclick = "go(1); return false;" > Advance to 6</ a > or
< a href = "?x=4" onclick = "go(-1); return false;" > retreat to 4</ a > ?
</ p >
< script >
var currentPage = 5 ; // prefilled by server
function go( d) {
setupPage( currentPage + d);
history. pushState( currentPage, "" , '?x=' + currentPage);
}
onpopstate = function ( event) {
setupPage( event. state);
}
function setupPage( page) {
currentPage = page;
document. title = 'Line Game - ' + currentPage;
document. getElementById( 'coord' ). textContent = currentPage;
document. links[ 0 ]. href = '?x=' + ( currentPage+ 1 );
document. links[ 0 ]. textContent = 'Advance to ' + ( currentPage+ 1 );
document. links[ 1 ]. href = '?x=' + ( currentPage- 1 );
document. links[ 1 ]. textContent = 'retreat to ' + ( currentPage- 1 );
}
</ script >
スクリプトをもたないシステムにおいて、前の例と同じように動作する。しかし、同じ体験に対するネットワークアクセスが存在しないので、スクリプトをサポートするユーザーは現在はるかに速く移動できる。さらに、経験に反して、ユーザーは単にナイーブなスクリプトベースのアプローチ、ブックマーク、およびセッション履歴の移動が依然として動作する必要がある。
上記の例において、pushState()
メソッドへのdata引数は、サーバーに送信されるものと同じ情報であるが、スクリプトはURLにユーザーが移動するたびに解析する必要はないので、より便利な形式となる。
ほとんどのアプリケーションは、すべての履歴エントリーに同じスクロール復元モード値を使用したいと考えている。これを実現するために、できるだけ早くscrollRestoration
属性を設定して(たとえば、文書のhead
要素の最初のscript
要素で)、履歴セッションに追加されたエントリーが確実に希望のスクロール復元モードになるようにする。
< head >
< script >
if ( 'scrollRestoration' in history)
history. scrollRestoration = 'manual' ;
</ script >
</ head >
グローバルnavigation
プロパティによって提供されるナビゲーションAPIは、ナビゲーションおよび履歴エントリーを管理するための最新のウェブアプリケーションに焦点を当てた方法を提供する。これは、従来のlocation
およびhistory
の後継である。
APIが提供する機能の1つは、セッション履歴エントリーの検査である。たとえば、次の例では、エントリーのURLが順序付きリストに表示される:
const ol = document. createElement( "ol" );
ol. start = 0 ; // so that the list items' ordinal values match up with the entry indices
for ( const entry of navigation. entries()) {
const li = document. createElement( "li" );
if ( entry. index < navigation. currentEntry. index) {
li. className = "backward" ;
} else if ( entry. index > navigation. currentEntry. index) {
li. className = "forward" ;
} else {
li. className = "current" ;
}
li. textContent = entry. url;
ol. append( li);
}
navigation.entries()
配列にはNavigationHistoryEntry
インスタンスが含まれており、これには、ここに示すurl
およびindex
プロパティに加えて、その他の便利なプロパティがある。配列には、現在のナビゲート可能を表すNavigationHistoryEntry
オブジェクトのみが含まれるため、その内容は、iframe
などのナビゲート可能なコンテナー内のナビゲーションまたは、ナビゲーションAPI自身がiframe
内で使用されている場合の親ナビゲート可能のナビゲーションの影響を受けないことに注意する。さらに、同一生成元セッション履歴エントリーを表す NavigationHistoryEntry
オブジェクトのみが含まれる。つまり、ユーザーが現在の生成元の前後に他の生成元を訪問した場合、対応するNavigationHistoryEntry
は存在しない。
ナビゲーションAPIを使用して、履歴をナビゲート、リロード、またはトラバースすることもできる:
< button onclick = "navigation.reload()" > Reload</ button >
< input type = "url" id = "navigationURL" >
< button onclick = "navigation.navigate(navigationURL.value)" > Navigate</ button >
< button id = "backButton" onclick = "navigation.back()" > Back</ button >
< button id = "forwardButton" onclick = "navigation.forward()" > Forward</ button >
< select id = "traversalDestinations" ></ select >
< button id = "goButton" onclick = "navigation.traverseTo(traversalDestinations.value)" > Traverse To</ button >
< script >
backButton. disabled = ! navigation. canGoBack;
forwardButton. disabled = ! navigation. canGoForward;
for ( const entry of navigation. entries()) {
traversalDestinations. append( new Option( entry. url, entry. key));
}
</ script >
ここでも、トラバーサルは同一生成元の宛先に制限されることに注意する。つまり、たとえば、前のセッション履歴エントリーが別の生成元からのページに対するものである場合、navigation.canGoBack
はfalseになる。
ナビゲーションAPIの最も強力な部分は、navigate
イベントである。このイベントは、現在のナビゲート可能でほとんどすべてのナビゲーションまたはトラバースが発生したときに発火する。
navigation. onnavigate = event => {
console. log( event. navigationType); // "push", "replace", "reload", or "traverse"
console. log( event. destination. url);
console. log( event. userInitiated);
// ... and other useful properties
};
(ナビゲーションの移動先が新しい文書である場合、ロケーションバーによって開始されたナビゲーションまたは他のウィンドウから開始されたナビゲーションに対してはイベントは発火しない。)
ほとんどの場合、イベントの cancelable
プロパティはtrueになる。つまり、このイベントはpreventDefault()
を使用してキャンセルできる:
navigation. onnavigate = event => {
if ( event. cancelable && isDisallowedURL( event. destination. url)) {
alert( `Please don't go to ${ event. destination. url} !` );
event. preventDefault();
}
};
一部の"traverse
"ナビゲーションでは、cancelable
プロパティがfalseになる。これには、子ナビゲーション可能内で行われるナビゲーション、新しい生成元に交差するナビゲーション、またはpreventDefault()
の前回の呼び出しでトラバースできなかった直後にユーザーが再度トラバースしようとした場合などがある。
NavigateEvent
のintercept()
メソッドを使用すると、ナビゲーションを横取りして、同じ文書のナビゲーションに変換できる:
navigation. addEventListener( "navigate" , e => {
// Some navigations, e.g. cross-origin navigations, we cannot intercept.
// Let the browser handle those normally.
if ( ! e. canIntercept) {
return ;
}
// Similarly, don't intercept fragment navigations or downloads.
if ( e. hashChange || e. downloadRequest !== null ) {
return ;
}
const url = new URL( event. destination. url);
if ( url. pathname. startsWith( "/articles/" )) {
e. intercept({
async handler() {
// The URL has already changed, so show a placeholder while
// fetching the new content, such as a spinner or loading page.
renderArticlePagePlaceholder();
// Fetch the new content and display when ready.
const articleContent = await getArticleContent( url. pathname, { signal: e. signal });
renderArticlePage( articleContent);
}
});
}
});
handler
は、ナビゲーションの非同期進行、および成功または失敗を表すプロミスを返すことができることに注意する。プロミスがまだ保留中である間、ブラウザーUIは、ナビゲーションを進行中として扱うことができる(たとえば、ローディングスピナーを提示することによって)。ナビゲーションAPIの他の部分も、navigation.navigate()
の返り値など、これらのプロミスに敏感である:
const { committed, finished } = await navigation. navigate( "/articles/the-navigation-api-is-cool" );
// The committed promise will fulfill once the URL has changed, which happens
// immediately (as long as the NavigateEvent wasn't canceled).
await committed;
// The finished promise will fulfill once the Promise returned by handler() has
// fulfilled, which happens once the article is downloaded and rendered. (Or,
// it will reject, if handler() fails along the way).
await finished;
Navigation
インターフェイス下記は、Navigation
インターフェイスを実装するすべてのオブジェクトによって、イベントハンドラーIDL属性として、サポートされるイベントハンドラー(および対応するイベントハンドラーイベント型)である:
イベントハンドラー | イベントハンドラーイベント型 |
---|---|
onnavigate | navigate |
onnavigatesuccess | navigatesuccess |
onnavigateerror | navigateerror |
oncurrententrychange | currententrychange |
ナビゲーションAPI全体で使用されるキータイプは、NavigationType
列挙である:
これは、主要なウェブ開発者が目に見える"navigation"のタイプをキャプチャしたものであり、(他の場所で指摘されているように)この標準の特異なナビゲートアルゴリズムに正確に対応していない。それぞれの値の意味は次のとおりである:
push
"push
"で終わるナビゲート、またはhistory.pushState()
の呼び出しに対応する。replace
"replace
"で終わるナビゲート、またはhistory.replaceState()
の呼び出しに対応する。reload
"traverse
"NavigationHistoryEntry
インターフェイスentry.
このナビゲーション履歴エントリーのURL。
エントリーが現在のものとは異なるDocument
に対応している場合(つまり、 sameDocument
がfalseである場合)、かつDocument
が"no-referrer
"または"origin
"のリファラーポリシーで取得された場合、nullを返すことができる。これは、問題のDocument
が他の同じ生成元のページからもURLを隠していることを示しているためである。
entry.
ナビゲーション履歴リスト内のこのナビゲーション履歴エントリーの位置を表す、ユーザーエージェントが生成したランダムなUUID文字列。この値は、"replace
"ナビゲーションのためにこの値を置き換える他の NavigationHistoryEntry
インスタンスによって再利用され、再読み込みおよびセッションの復元後も存続する。
これは、navigation.traverseTo(key)
を使用して、ナビゲーション履歴リストのこのエントリーに戻るのに役立つ。
entry.
この特定のナビゲーション履歴エントリーを表す、ユーザーエージェントによって生成されたランダムなUUID文字列。この値は、他のNavigationHistoryEntry
インスタンスによって再利用されない。この値は、リロードおよびセッションのリストア後も保持される。
これは、他のストレージAPIを使用してこのナビゲーション履歴エントリーにデータを関連付ける場合に役立つ。
entry.
navigation.entries()
内のこのNavigationHistoryEntry
のインデックス。または、エントリーがナビゲーション履歴エントリーリストにない場合は-1。
entry.
このナビゲーション履歴エントリーが現在のDocument
と同じかどうかを示す。たとえば、エントリーがフラグメントナビゲーションまたは単一ページのアプリナビゲーションを表す場合、これはtrueになる。
entry.
()navigation.navigate()
またはnavigation.updateCurrentEntry()
を用いてエントリーに追加された、このエントリーに格納されている状態のデシリアライズを返す。この状態は、リロードおよびセッションのリストア後も保持される。
一般に、状態値がプリミティブentry.getState() !== entry.getState()
でない限り、毎回新しいデシリアライズが返されることに注意する。
この状態は、従来の履歴API history.state
とは関係ない。
下記は、NavigationHistoryEntry
インターフェイスを実装するすべてのオブジェクトによって、イベントハンドラーIDL属性として、サポートされるイベントハンドラー(および対応するイベントハンドラーイベント型)である:
イベントハンドラー | イベントハンドラーイベント型 |
---|---|
ondispose | dispose |
entries = navigation.
現在のナビゲーション履歴エントリーリストを表すNavigationHistoryEntry
インスタンスの配列を返す。これはつまり、現在のセッション履歴エントリーと同一生成元で隣接する、このナビゲーション可能のすべてのセッション履歴エントリーである。
navigation.
現在のセッション履歴エントリーに対応するNavigationHistoryEntry
を返す。
navigation. ({ state })
navigation.reload()
のようなナビゲーションを実行せずに、現在のセッション履歴エントリーのナビゲーションAPI状態を更新する。
このメソッドは、すでに発生しており、ナビゲーションAPI状態に反映する必要があるページの更新をキャプチャするのに最適である。状態の更新がページ更新を駆動することを意図している場合、代わりにnavigation.navigate()
または navigation.reload()
を使用する。これにより、 navigate
イベントがトリガーされる。
navigation.
現在の現在のセッション履歴エントリーつまり、(currentEntry
)がナビゲーション履歴エントリーリストの最初のエントリー(つまり、entries()
)でない場合、trueを返す。これは、このナビゲート可能に対して以前のセッション履歴エントリーがあり、その文書状態の生成元が現在のDocument
の生成元と同一生成元であることを意味する。
navigation.
現在の現在のセッション履歴エントリーつまり、(currentEntry
)がナビゲーション履歴エントリーリストの最後のエントリー(つまり、entries()
)でない場合、trueを返す。これは、このナビゲート可能に対して次のセッション履歴エントリーがあり、その文書状態の生成元が現在のDocument
の生成元と同一生成元であることを意味する。
{ committed, finished } = navigation. (url)
{ committed, finished } = navigation.navigate(url, options)
現在のページを指定しurlにナビゲートする。optionsには、次の値を含めることができる:
history
を"replace
"に設定すると、新しいセッション履歴エントリーをプッシュする代わりに、現在のセッション履歴エントリーを置き換えることができる。
info
には任意の値を設定できる。対応するNavigateEvent
のinfo
プロパティに値が設定される。
state
には、任意のシリアル化可能な値を設定できる。同じ文書のナビゲーションの場合、ナビゲーションが完了すると、navigation.currentEntry.getState()
によって取得された状態が設定される。(異なる文書間のナビゲーションでは無視される。)
デフォルトでは、これは完全なナビゲーションを実行する(つまり、指定されたURLが現在のURLとフラグメントのみが異なる場合を除き、異なる文書間のナビゲーションを実行する)。navigateEvent.intercept()
を使用すると、同じ文書のナビゲーションに変換できる。
返されたプロミスは次のように動作する:
ナビゲーションが中止された場合、両方のプロミスは"AbortError
" DOMException
で拒否される。
navigateEvent.intercept()
メソッドを使用して作成された同じ文書のナビゲーションの場合、committed
は直ちに実行され、finished
はintercept()
に渡されたハンドラーによって返されたプロミスに従って実行または拒否される。
他の同じ文書ナビゲーション(たとえば、傍受されていないフラグメントナビゲーション)については、両方のプロミスが直ちに実行される。
異なる文書間のナビゲーション、またはサーバーからの204または205ステータスまたは`Content-Disposition: attachment
`ヘッダーフィールドになる(したがって実際にはナビゲートしない)ナビゲーションの場合、両方のプロミスは一切解決されない。
いずれの場合も、返されたプロミスが実行されるとき、ナビゲート先のNavigationHistoryEntry
が使用される。
{ committed, finished } = navigation. (options)
現在のページをリロードする。optionsは、上記のように動作するinfo
およびstate
を含めることができる。
現在のページのネットワークまたはキャッシュからのリロードを実行するデフォルトの動作は、 navigateEvent.intercept()
メソッドを使用して上書きできます。そうすることは、この呼び出しが状態を更新する、または適切なinfo
に沿って渡すだけでなく、navigate
イベントハンドラーが実行に適していると判断したアクションを実行することを意味する。
返されたプロミスは次のように動作する:
リロードがnavigateEvent.intercept()
メソッドを使用してインターセプトされた場合、committed
はすぐに実行され、finished
はintercept()
に渡されたハンドラによって返されたプロミスに従って実行または拒否される。
そうでなければ、両方のプロミスは決して解決しないだろう。
{ committed, finished } = navigation. (key)
{ committed, finished } = navigation.traverseTo(key, { info })
指定されたkeyのNavigationHistoryEntry
にマッチする最も近いセッション履歴エントリーにトラバースする。info
には任意の値を設定できる。対応するNavigateEvent
のinfo
プロパティに値が設定される。
そのセッション履歴エントリーへのトラバーサルがすでに進行中である場合、これは元のトラバーサルのプロミスを返し、info
は無視される。
返されたプロミスは次のように動作する:
key
がkeyにマッチするnavigation.entries()
にNavigationHistoryEntry
がない場合、両方のプロミスは"InvalidStateError
" DOMException
で拒否される。
navigateEvent.intercept()
メソッドによってインターセプトされた同じ文書のトラバースの場合、committed
は、トラバースが処理され、navigation.currentEntry
が更新されるとすぐに実行され、finished
は、intercept()
に渡されたハンドラーによって返されたすべてのプロミスに従って実行または拒否される。
インターセプトされていない同じ文書のトラバーサルの場合、トラバーサルが処理され、navigation.currentEntry
が更新されるとすぐに、両方のプロミスが実行される。
異なる文書間のトラバーサルでは、最終的にサーバーからの204または205ステータスまたは`Content-Disposition: attachment
`ヘッダーフィールドになる(したがって実際にはトラバーサルしない)、異なる文書間のトラバーサルの試みを含めて、両方のプロミスは決して解決されない。
{ committed, finished } = navigation. (key)
{ committed, finished } = navigation.back(key, { info })
最も近い前のセッション履歴エントリーに移動し、その結果、このナビゲート可能なトラバースが行われる。つまり、別のNavigationHistoryEntry
に対応するため、 navigation.currentEntry
が変更される。info
には任意の値を設定できる。対応するNavigateEvent
のinfo
プロパティに値が設定される。
そのセッション履歴エントリーへのトラバーサルがすでに進行中である場合、これは元のトラバーサルのプロミスを返し、info
は無視される。
返されたプロミスは、traverseTo()
によって返された往路ミスと同じように動作する。
{ committed, finished } = navigation. (key)
{ committed, finished } = navigation.forward(key, { info })
最も近い前方のセッション履歴エントリーに移動し、その結果、このナビゲート可能なトラバースが行われる。つまり、別のNavigationHistoryEntry
に対応するため、navigation.currentEntry
が変更される。info
には任意の値を設定できる。対応するNavigateEvent
のinfo
プロパティに値が設定される。
そのセッション履歴エントリーへのトラバーサルがすでに進行中である場合、これは元のトラバーサルのプロミスを返し、info
は無視される。
返されたプロミスは、traverseTo()
によって返された往路ミスと同じように動作する。
navigation.
存在する場合、navigatesuccess
またはnavigateerror
ステージに到達していない進行中のナビゲーションを表すNavigationTransition
。そのような移行が進行中でない場合、nullになる。
navigation.currentEntry
(および location.href
などの他のプロパティ)はナビゲーションの直後に更新されるため、このnavigation.transition
プロパティは、navigateEvent.intercept()
に渡されたハンドラーに従って、そのようなナビゲーションがまだ完全に確定していないときを判断するのに役立つ。
navigation.transition.
"push
"、"replace
"、"reload
"、または "traverse
"のいずれかで、このトランジションのナビゲーションの種類を示す。
navigation.transition.
遷移元のNavigationHistoryEntry
。これはnavigation.currentEntry
と比較するのに役立つ。
navigation.transition.
navigatesuccess
が発火すると同時に実行されるプロミス、または navigateerror
イベントが発火すると同時に拒否されるプロミス。
NavigationActivation
インターフェイスnavigation.activation
このDocument
を"activated"にしたナビゲーションである、最新の文書間ナビゲーションに関する情報を含むNavigationActivation
。
navigation.currentEntry
とDocument
のURLは同じ文書のナビゲーションにより定期的に更新できるが、navigation.activation
は一定に保たれ、Document
がreactivated履歴から更新された場合にのみ、そのプロパティは更新される。
navigation.activation.entry
Document
がアクティブになった時点のnavigation.currentEntry
プロパティの値と同じNavigationHistoryEntry
。
navigation.activation.from
現在のDocument
の直前にアクティブであったDocument
を表す NavigationHistoryEntry
。前のDocument
がこの文書と同一生成元ではなかった場合、またはinitial about:blank
Document
であった場合、値はnullになる。
from
またはentry
NavigationHistoryEntry
オブジェクトは、履歴に保持されない可能性があるため、traverseTo()
メソッドの実行可能なターゲットにならない場合がある。たとえば、Document
はlocation.replace()
を使用してアクティブにすることができ、その初期エントリーはhistory.replaceState()
で置き換えることができる。しかし、これらのエントリーのurl
プロパティおよびgetState()
メソッドには引き続きアクセス可能である。
navigation.activation.navigationType
"push
"、"replace
"、"reload
"、または "traverse
"のいずれかで、このDocument
をアクティブにしたナビゲーションのタイプを示す。
各Navigation
は、関連付けられたactivationがある。これはnull、または最初はnullであるNavigationActivation
オブジェクトである。
各NavigationActivation
には、次のものがある:
old entry、nullまたはNavigationHistoryEntry
。
new entry、nullまたはNavigationHistoryEntry
。
navigation type、NavigationType
。
activation
ゲッターステップは、thisのactivationを返す。
from
ゲッターステップは、thisのold entryを返す。
entry
ゲッターステップは、thisのnew entryを返す。
navigationType
ゲッターステップは、thisのnavigation entryを返す。
navigate
イベントナビゲーションAPIの主な機能は、navigate
イベントである。このイベントはすべてのナビゲーション(広義の意味で)で発火し、ウェブ開発者はそのような発信ナビゲーションを監視できる。多くの場合、イベントはcancelable
であり、これはナビゲーションが発生しないようにすることができる。また、NavigateEvent
クラスのintercept()
メソッドを使用して、ナビゲーションをインターセプトし、同じ文書のナビゲーションに置き換えることもできる。
NavigateEvent
インターフェイスevent.
"push
"、"replace
"、"reload
"、または"traverse
"のいずれかで、ナビゲーションの種類を示す。
event.
ナビゲーションの目的地を表すNavigationDestination
。
event.
intercept()
を呼び出してこのナビゲーションをインターセプトし、同じ文書のナビゲーションに変換して通常の動作を置き換えることができる場合はtrue、そうでなければfalse。
一般的にいえば、これは、現在のDocument
が宛先URLにそのURLを書き換えることができる場合は常にtrueになるが、異なる文書間の"traverse
"ナビゲーションの場合は例外であり、常にfalseになる。
event.
ユーザーが a
要素をクリックした場合、form
要素を送信した場合、またはブラウザーUIを使用して移動した場合はtrue、そうでなければfalse。
event.
フラグメントナビゲーションの場合はtrue、そうでなければfalse。
event.
AbortSignal
は、たとえばユーザーがブラウザーの"停止"ボタンを押したり、別のナビゲーションがこれを中断したりするなどして、ナビゲーションがキャンセルされた場合、中止される。
期待されるパターンは、開発者がこれをfetch()
などの非同期操作に渡すことであり、開発者はこのナビゲーションを処理する一部として実行する。
event.
このナビゲーションがPOSTフォーム送信を表す"push
"または"replace
"ナビゲーションの場合、このナビゲーションに対して送信されたフォームエントリーを表すFormData
。そうでなければnull。
(特に、最初にフォーム送信から作成されたセッション履歴エントリーを再訪問する"reload
"または"traverse
"ナビゲーションの場合であっても、これはnullになる。)
event.
a
またはarea
要素のdownload
属性を使用することによって、このナビゲーションがダウンロードとして要求されたかどうかを表す。
ダウンロードが要求されなかった場合、このプロパティはnullである。
ダウンロードが要求された場合、download
属性の値として指定されたファイル名を返す。(This could be the empty string.)
ダウンロードが要求されても、必ずしもダウンロードが実行されるとは限らないことに注意する。たとえば、ダウンロードがブラウザーのセキュリティポリシーによってブロックされたり、理由は不明だが"push
"ナビゲーションとして処理されたりする場合がある。
同様に、ナビゲーションは、たとえダウンロードであることが要求されていなくても、宛先サーバーが`Content-Disposition: attachment
`ヘッダーで応答するために、最終的にダウンロードとなる可能性がある。
最後に、navigate
イベントは、ブラウザーUIアフォーダンスを使用して開始されたダウンロード、たとえば、リンクのターゲットを右クリックして保存するのを選択することによって作成されたダウンロードに対してはまったく発火しないことに注意する。
event.
このナビゲーションを開始したナビゲーションAPIメソッドの1つによって渡される任意のJavaScript値、またはナビゲーションがユーザーまたは別のAPIによって開始された場合、undefined。
event.
ユーザーエージェントが、このイベントをディスパッチする前に、このナビゲーションのビジュアルトランジションを実行した場合、trueを返す。trueの場合、著者がDOMをナビゲーション後の状態に同期的に更新するならば、最高のユーザーエクスペリエンスが得られる。
event.
このナビゲーションを担当するElement
を返す。これはa
またはarea
要素、送信ボタン、または送信されたform
要素になる。
event.
({ , , })通常の処理を行わずに、宛先URLと同じ種類の同じ文書に変換して、このナビゲーションを途中で取得する。
handler
オプションは、プロミスを返す関数を指定できる。ハンドラー関数は、navigate
イベントの発火が終了し、navigation.currentEntry
プロパティが同期的に更新された後に実行される。この返されたプロミスは、ナビゲーションの期間と成功または失敗を通知するために使用される。それが落ち着いた後、ブラウザーは、ナビゲーションが終了したことを(たとえば、ローディングスピナーUI、は支援技術を介して)ユーザーに知らせる。さらに、必要に応じてnavigatesuccess
またはnavigateerror
イベントを発火させ、これはウェブアプリケーションの他の部分が応答できるようにする。
デフォルトでは、このメソッドを使用すると、ハンドラーから返されたプロミスが確定するときにフォーカスがリセットされる。フォーカスは、autofocus
属性が設定された最初の要素、または属性が存在しない場合body要素にリセットされる。この動作を回避するには、focusReset
オプションを"manual
"に設定する。
デフォルトでは、このメソッドを使用すると、ハンドラーの返り値が確定するまで、"traverse
"または"reload
ナビゲーションのブラウザーのスクロール復元ロジック、または"push
もしくは"replace
"ナビゲーションのスクロールリセット/フラグメントへのスクロールロジックが遅延される。scroll
オプションを"manual
"に設定すると、このナビゲーションに対してブラウザーによるスクロール動作を完全にオフにすることができる。また、プロミスが落ち着く前にscroll()
を呼び出して、この動作を早期にトリガーすることもできる。
canIntercept
がfalseである場合、またはisTrusted
がfalseである場合、このメソッドは"SecurityError
" DOMException
を投げる。イベントのディスパッチ中に同期的に呼び出されなかった場合、"InvalidStateError
" DOMException
を投げる。
event.
()"traverse
"または"reload
"ナビゲーションの場合、ブラウザーの通常のスクロール復元ロジックを使用してスクロール位置を復元する。
"push
"または"replace
"ナビゲーションの場合、スクロール位置を文書の先頭にリセットする、またはdestination.url
で指定されたフラグメントがあるいずれかの場合、その場所こスクロールする。
複数回呼び出された場合、scroll
オプションが"after-transition
"のままになっているために遷移後の自動スクロール処理が行われた後に呼び出された場合、またはナビゲーションがコミットされる前に呼び出された場合、このメソッドは"InvalidStateError
" DOMException
を投げる。
NavigationDestination
インターフェイスevent.destination.url
ナビゲート先のURL。
event.destination.key
"traverse
"ナビゲーションである場合、宛先NavigationHistoryEntry
の key
プロパティの値。そうでなければ空の文字列。
event.destination.id
"traverse
"ナビゲーションである場合、宛先NavigationHistoryEntry
の id
プロパティの値。そうでなければ空の文字列。
event.destination.index
"traverse
"ナビゲーションである場合、宛先NavigationHistoryEntry
のindex
ロパティの値。そうでなければ-1。
event.destination.sameDocument
このナビゲーションが現在のナビゲーションと同じDocument
であるかどうかを示す。これは、たとえばフラグメントナビゲーションやhistory.pushState()
ナビゲーションの場合に当てはまる。
このプロパティは、ナビゲーションの本来の性質を示していることに注意すること。navigateEvent.intercept()
を使用して文書間のナビゲーションを同じ文書のナビゲーションに変換しても、このプロパティの値は変わらない。
event.destination.getState()
"traverse
"ナビゲーションの場合、宛先セッション履歴エントリーに格納されている状態の逆シリアル化を返す。
For "push
"または"replace
"ナビゲーションの場合、ナビゲーションがそのメソッドによって開始された場合はnavigation.navigate()
に渡された状態の逆シリアル化を返し、開始されなかった場合はundefinedを返す。
"reload
"ナビゲーションの場合、リロードがnavigation.reload()
メソッドによって開始された場合、そのメソッドに渡された状態の逆シリアライズを返す。リロードが開始されなかった場合、undefinedを返す。
NavigateEvent
インターフェイスには、その複雑さのために独自の専用セクションを持つ。
NavigationCurrentEntryChangeEvent
インターフェイスevent.
現在のエントリーを変更したナビゲーションのタイプを返す。変更の原因がnavigation.updateCurrentEntry()
の場合、nullを返す。
event.
現在のエントリーが変更される前のnavigation.currentEntry
の値を返す。
navigationType
がnullまたは"reload
"である場合、この値はnavigation.currentEntry
と同じになる。この場合、イベントは、たとえ新しいエントリーに移動しなかった、または現在のエントリーを置き換えなかったとしても、エントリーの内容が変更されたことを示す。
PopStateEvent
インターフェイスSupport in all current engines.
Support in all current engines.
event.state
pushState()
またはreplaceState()
へ提供される情報のコピーを返す。
event.hasUAVisualTransition
ユーザーエージェントが、このイベントをディスパッチする前に、このナビゲーションのビジュアルトランジションを実行した場合、trueを返す。trueの場合、著者がDOMをナビゲーション後の状態に同期的に更新するならば、最高のユーザーエクスペリエンスが得られる。
HashChangeEvent
インターフェイスHashChangeEvent/HashChangeEvent
Support in all current engines.
Support in all current engines.
event.oldURL
以前に現在であったセッション履歴のエントリーのURLを返す。
event.newURL
今現在であるセッション履歴のエントリーのURLを返す。
PageSwapEvent
インターフェイスevent.activation
ドキュメント間ナビゲーションの移動先と種類を表すNavigationActivation
オブジェクト。異なる生成元のナビゲーションの場合はnullになる。
event.activation.entry
アクティブになるDocument
を表すNavigationHistoryEntry
。
event.activation.from
イベントが発火した時点でのnavigation.currentEntry
プロパティの値に相当するNavigationHistoryEntry
。
event.activation.navigationType
"push
"、"replace
"、"reload
"または"traverse
"のいずれかで、ページスワップが行われるナビゲーションのタイプを示す。
event.viewTransition
イベントが発火したときに遷移がアクティブである場合、アウトバウンドの文書間の参照の遷移を表すViewTransition
オブジェクトを返す。そうでなければ、nullを返す。
PageRevealEvent
インターフェイスevent.viewTransition
イベントが発火したときに遷移がアクティブである場合、インバウンドの文書間の参照の遷移を表す ViewTransition
オブジェクトを返す。そうでなければ、nullを返す。
PageTransitionEvent
インターフェイスPageTransitionEvent/PageTransitionEvent
Support in all current engines.
Support in all current engines.
event.persisted
pageshow
に対して、ページが新しく読み込まれている(およびload
イベントが発生する)場合にfalseを返す。そうでなければ、trueを返す。
pagehide
イベントに対して、ページが最後の時間まで出かける場合はfalseを返す。そうでなければtrueを返す。これは、ユーザーがこのページに戻った場合(Document
のsalvageable状態がtrueのままの場合)にページが再利用される可能性があることを意味する。
ページがサルベージ不能になる原因には、次のものがある:
ユーザーエージェントが、アンロード後にセッション履歴エントリーでDocument
を存続させないことを決定した
salvageableではないiframe
を持っている
アクティブなWebSocket
オブジェクト
BeforeUnloadEvent
インターフェイスSupport in all current engines.
BeforeUnloadEvent
固有の初期化メソッドは存在しない。
BeforeUnloadEvent
インターフェイスは、イベントをキャンセルするだけでなく、returnValue
属性を空文字列以外の値に設定することで、アンロードがキャンセルされたかどうかをチェックできるようにするレガシーインターフェイスである。著者は、returnValue
を使用する代わりに、preventDefault()
メソッド、またはイベントをキャンセルするその他の手段を使用すべきである。
NotRestoredReasons
インターフェイスnotRestoredReasonDetails.reason
ドキュメントがバック/フォワードキャッシュから処理できなかった理由を説明する文字列を返す。使用可能な文字列値については、bfcache blocking detailsの定義を参照。
notRestoredReasons.src
文書がiframe
要素である場合、文書のノードナビゲート可能のコンテナーのsrc
属性を返す。設定されていない場合、またはiframe
要素ではない場合、nullを指定できる。
notRestoredReasons.id
文書がiframe
要素である場合、文書のノードナビゲート可能のコンテナーのid
属性を返す。設定されていない場合、またはiframe
要素ではない場合、nullを指定できる。
notRestoredReasons.name
文書がiframe
要素である場合、文書のノードナビゲート可能のコンテナーのname
属性を返す。設定されていない場合、またはiframe
要素ではない場合、nullを指定できる。
notRestoredReasons.url
文書のURL、または文書が異なる生成元のiframe
内にある場合、nullを返す。これは、元のsrc
が設定されてからiframe
にナビゲートできるため、src
に加えて報告される。
notRestoredReasons.reasons
文書のNotRestoredReasonDetails
の配列を返す。文書が生成元をまたいだiframe
にある場合、これはnullである。
notRestoredReasons.children
文書のNotRestoredReasons
の配列を返す。文書が生成元をまたいだiframe
にある場合、これはnullである。
NotRestoredReasonDetails
オブジェクトは、バッキング構造体、復元されていない理由の詳細、またはnullを持ち、最初はnullである。
The reason
getter steps are to return this's backing struct's reason.
To create a NotRestoredReasonDetails
object given a not restored reason details backingStruct and a realm realm:
Let notRestoredReasonDetails be a new NotRestoredReasonDetails
object created in realm.
Set notRestoredReasonDetails's backing struct to backingStruct.
Return notRestoredReasonDetails.
A not restored reason details is a struct with the following items:
reason, a string, initially empty.
The reason is a string that represents the reason that prevented the page from being restored from back/forward cache. The string is one of the following:
fetch
"Document
was still ongoing and was canceled, so the page was not in a state that could be stored in the back/forward cache.navigation-failure
"Document
errored, so storing the resulting error document in the back/forward cache was prevented.parser-aborted
"Document
never finished its initial HTML parsing, so storing the unfinished document in the back/forward cache was prevented.websocket
"WebSocket
connection was shut down, so the page was not in a state that could be stored in the back/forward cache. [WEBSOCKETS]lock
"masked
"Document
has children that are in a cross-origin iframe
, and they prevented back/forward cache; or this Document
could not be back/forward cached for user agent-specific reasons, and the user agent has chosen not to use one of the more specific reasons from the list of user-agent specific blocking reasons.In addition to the list above, a user agent might choose to expose a reason that prevented the page from being restored from back/forward cache for user-agent specific blocking reasons. These are one of the following strings:
audio-capture
"Document
requested audio capture permission by using Media Capture and Streams's getUserMedia()
with audio. [MEDIASTREAM]background-work
"Document
requested background work by calling SyncManager
's register()
method, PeriodicSyncManager
's register()
method, or BackgroundFetchManager
's fetch()
method.broadcastchannel-message
"BroadcastChannel
connection on the page received a message and message
event was fired.idbversionchangeevent
"Document
had a pending IDBVersionChangeEvent
while unloading. [INDEXEDDB]idledetector
"Document
had an active IdleDetector
while unloading.keyboardlock
"Keyboard
's lock()
method was called.mediastream
"MediaStreamTrack
was in the live state upon unloading. [MEDIASTREAM]midi
"Document
requested a MIDI permission by calling navigator.requestMIDIAccess()
.modals
"navigating
"Document
was not in a state that could be stored in back/forward cache.navigation-canceled
"window.stop()
and the page was not in a state to be stored in back/forward cache.non-trivial-browsing-context-group
"Document
had more than one top-level browsing context.otpcredential
"Document
created an OTPCredential
.outstanding-network-request
"Document
had outstanding network requests and was not in a state that could be stored in back/forward cache.paymentrequest
"Document
had an active PaymentRequest
while unloading. [PAYMENTREQUEST]pictureinpicturewindow
"Document
had an active PictureInPictureWindow
while unloading. [PICTUREINPICTURE]plugins
"Document
contained plugins.request-method-not-get
"Document
was created from an HTTP request whose method was not `GET
`. [FETCH]response-auth-required
"Document
was created from an HTTP response that required HTTP authentication.response-cache-control-no-store
"Document
was created from an HTTP response whose `Cache-Control
` header included the "no-store
" token. [HTTP]response-cache-control-no-cache
"Document
was created from an HTTP response whose `Cache-Control
` header included the "no-cache
" token. [HTTP]response-keep-alive
"Document
was created from an HTTP response that contained a `Keep-Alive
` header.response-scheme-not-http-or-https
"Document
was created from a response whose URL's scheme was not an HTTP(S) scheme. [FETCH]response-status-not-ok
"Document
was created from an HTTP response whose status was not an ok status. [FETCH]rtc
"RTCPeerConnection
or RTCDataChannel
was shut down, so the page was not in a state that could be stored in the back/forward cache. [WEBRTC]sensors
"Document
requested sensor access.serviceworker-added
"Document
's service worker client started to be controlled by a ServiceWorker
while the page was in back/forward cache. [SW]serviceworker-claimed
"Document
's service worker client's active service worker was claimed while the page was in back/forward cache. [SW]serviceworker-postmessage
"Document
's service worker client's active service worker received a message while the page was in back/forward cache. [SW]serviceworker-version-activated
"Document
's service worker client's active service worker's version was activated while the page was in back/forward cache. [SW]serviceworker-unregistered
"Document
's service worker client's active service worker's service worker registration was unregistered while the page was in back/forward cache. [SW]sharedworker
"Document
was in the owner set of a SharedWorkerGlobalScope
.smartcardconnection
"Document
had an active SmartCardConnection
while unloading.speechrecognition
"Document
had an active SpeechRecognition
while unloading.storageaccess
"Document
requested storage access permission by using the Storage Access API.unload-listener
"Document
registered an event listener for the unload
event.video-capture
"Document
requested video capture permission by using Media Capture and Streams's getUserMedia()
with video. [MEDIASTREAM]webhid
"Document
called the WebHID API's requestDevice()
method.webshare
"Document
used the Web Share API's navigator.share()
method.webtransport
"WebTransport
connection was shut down, so the page was not in a state that could be stored in the back/forward cache. [WEBTRANSPORT]webxrdevice
"Document
created a XRSystem
.A NotRestoredReasons
object has a backing struct, a not restored reasons or null, initially null.
A NotRestoredReasons
object has a reasons array, a FrozenArray<
or null, initially null.NotRestoredReasonDetails
>
A NotRestoredReasons
object has a children array, a FrozenArray<NotRestoredReasons>
or null, initially null.
The src
getter steps are to return this's backing struct's src.
The id
getter steps are to return this's backing struct's id.
The name
getter steps are to return this's backing struct's name.
The url
getter steps are:
If this's backing struct's URL is null, then return null.
Return this's backing struct's URL, serialized.
The reasons
getter steps are to return this's reasons array.
The children
getter steps are to return this's children array.
To create a NotRestoredReasons
object given a not restored reasons backingStruct and a realm realm:
Let notRestoredReasons be a new NotRestoredReasons
object created in realm.
Set notRestoredReasons's backing struct to backingStruct.
If backingStruct's reasons is null, set notRestoredReasons's reasons array to null.
Otherwise:
Let reasonsArray be an empty list.
For each reason of backingStruct's reasons:
Create a NotRestoredReasonDetails
object given reason and realm, and append it to reasonsArray.
Set notRestoredReasons's reasons array to the result of creating a frozen array given reasonsArray.
If backingStruct's children is null, set notRestoredReasons's children array to null.
Otherwise:
Let childrenArray be an empty list.
For each child of backingStruct's children:
Create a NotRestoredReasons
object given child and realm and append it to childrenArray.
Set notRestoredReasons's children array to the result of creating a frozen array given childrenArray.
Return notRestoredReasons.
A not restored reasons is a struct with the following items:
src, a scalar value string or null, initially null.
id, a string or null, initially null.
name, a string or null, initially null.
url, a URL or null, initially null.
reasons, null or a list of not restored reason details, initially null.
children, null or a list of not restored reasons, initially null.
A Document
's not restored reasons is its node navigable's active session history entry's document state's not restored reasons, if Document
's node navigable is a top-level traversable; otherwise null.