From 33058f2b292b3a581333bdfb21b8f671898c5060 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:40:17 -0500 Subject: initial commit --- files/ja/web/api/window/history/index.html | 65 ++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 files/ja/web/api/window/history/index.html (limited to 'files/ja/web/api/window/history') diff --git a/files/ja/web/api/window/history/index.html b/files/ja/web/api/window/history/index.html new file mode 100644 index 0000000000..e7a7e8ebc7 --- /dev/null +++ b/files/ja/web/api/window/history/index.html @@ -0,0 +1,65 @@ +--- +title: window.history +slug: Web/API/Window/history +tags: + - Gecko + - HTML DOM + - History API + - Window + - 要更新 +translation_of: Web/API/Window/history +--- +

{{ ApiRef }}

+ +

読み取り専用プロパティWindow.historyは、{{domxref("History")}}オブジェクトへの参照を返します。{{domxref("History")}}はブラウザのセッション(今開いているタブやそのページが読み込まれているウィンドウで過去に訪れたページの履歴)を操作するインターフェースを提供します。

+ +

詳細や使用例については Manipulating the browser history をご覧ください。このページでは特にpushState()メソッドや replaceState()メソッドについてセキュリティの観点から詳しく解説がなされています。これらのメソッドは注意して使う必要があります。

+ +

{{ 英語版章題("Syntax") }}

+ +

構文

+ +
var historyObj = window.history;
+
+ +

{{ 英語版章題("Example") }}

+ +

+ +
history.back();     // 戻るボタンを押したのと同じ効果
+history.go(-1);     // history.back();と同等の効果が得られます
+
+ +

{{ 英語版章題("Notes") }}

+ +

注記

+ +

For top-level pages you can see the list of pages in the session history, accessible via the History object, in the browser's dropdowns next to the back and forward buttons.

+ +

Historyオブジェクトはセッション履歴の他のページのURLへアクセスしようとする許可なきコードはセキュリティ上の理由から禁止しています。ただ、セッション履歴のあいだを行き来することは許可されています。

+ +

権限のないコードでセッション履歴を消去したり、戻る/進む操作を無効にしたりする方法はありません。このような機能をどうしても実現したいのならlocation.replace() メソッドを使うのがよいでしょう。このメソッドは現在のセッションを引数のURLに置き換えることができます。

+ +

{{ 英語版章題("Specification") }}

+ +

仕様

+ + + + + + + + + + + + + + + + + + + +
仕様状態コメント
{{SpecName('HTML WHATWG', 'browsers.html#the-history-interface', 'The History interface')}}{{Spec2('HTML WHATWG')}}
{{SpecName('HTML5 W3C', 'browsers.html#the-history-interface', 'The History interface')}}{{Spec2('HTML5 W3C')}}
-- cgit v1.2.3-54-g00ecf