aboutsummaryrefslogtreecommitdiff
path: root/files/ja/web/api/history/go/index.html
diff options
context:
space:
mode:
Diffstat (limited to 'files/ja/web/api/history/go/index.html')
-rw-r--r--files/ja/web/api/history/go/index.html91
1 files changed, 91 insertions, 0 deletions
diff --git a/files/ja/web/api/history/go/index.html b/files/ja/web/api/history/go/index.html
new file mode 100644
index 0000000000..c449782e70
--- /dev/null
+++ b/files/ja/web/api/history/go/index.html
@@ -0,0 +1,91 @@
+---
+title: History.go()
+slug: Web/API/History/go
+tags:
+ - API
+ - HTML DOM
+ - History
+ - History API
+ - Method
+ - Reference
+translation_of: Web/API/History/go
+---
+<div>{{APIRef("History API")}}</div>
+
+<p><strong><code>History.go()</code></strong> メソッドは、セッション履歴から特定のページを読み込みます。これを用いると、引数の値に応じて履歴の中を前方や後方に移動することができます。</p>
+
+<p>このメソッドは{{glossary("asynchronous", "非同期")}}です。移動が完了したときを検知したい場合は {{event("popstate")}} イベントのリスナーを追加してください。</p>
+
+<h2 id="Syntax" name="Syntax">構文</h2>
+
+<pre class="syntaxbox notranslate">history.go([<var>delta</var>])</pre>
+
+<h3 id="Parameters" name="Parameters">引数</h3>
+
+<dl>
+ <dt><code><var>delta</var></code> {{optional_inline}}</dt>
+ <dd>履歴の中を移動したい先の位置で、現在のページからの相対位置です。負の数の場合は前方に移動し、正の値の場合は後方へ移動します。すなわち、例えば、 <code>history.go(2)</code> は2ページ後に移動し、 <code>history.go(-2)</code> は2ページ前に戻ります。値が渡されなかったときや、 <code>delta</code> が 0 と等しいときは、 <code>location.reload()</code> の呼び出しと同じ効果になります。</dd>
+</dl>
+
+<h2 id="Examples" name="Examples">例</h2>
+
+<p>一つページを戻す場合 ({{domxref("History.back", "back()")}} の呼び出しと同等):</p>
+
+<pre class="brush: js notranslate">history.go(-1)</pre>
+
+<p>一つページを進める場合、 {{domxref("History.forward", "forward()")}} の呼び出しと同等:</p>
+
+<pre class="brush: js notranslate">history.go(1)</pre>
+
+<p>二つページを進める場合:</p>
+
+<pre class="brush: js notranslate">history.go(2);</pre>
+
+<p>二つページを戻す場合:</p>
+
+<pre class="brush: js notranslate">history.go(-2);</pre>
+
+<p>そして、以下の文はいずれも現在のページを再読み込みします。</p>
+
+<pre class="brush: js notranslate">history.go();
+history.go(0);</pre>
+
+<h2 id="Specifications" name="Specifications">仕様書</h2>
+
+<table class="standard-table">
+ <thead>
+ <tr>
+ <th scope="col">仕様書</th>
+ <th scope="col">状態</th>
+ <th scope="col">備考</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td>{{SpecName("HTML WHATWG", "history.html#dom-history-go", "History.go()")}}</td>
+ <td>{{Spec2("HTML WHATWG")}}</td>
+ <td>{{SpecName("HTML5 W3C")}} から変更なし</td>
+ </tr>
+ <tr>
+ <td>{{SpecName("HTML5 W3C", "browsers.html#dom-history-go", "History.go()")}}</td>
+ <td>{{Spec2("HTML5 W3C")}}</td>
+ <td>初回定義</td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="Browser_compatibility" name="Browser_compatibility">ブラウザーの互換性</h2>
+
+<div class="hidden">このページの互換性一覧表は構造化データから生成されています。データに協力していただけるのであれば、 <a class="external" href="https://github.com/mdn/browser-compat-data">https://github.com/mdn/browser-compat-data</a> をチェックアウトしてプルリクエストを送信してください。</div>
+
+<p>{{Compat("api.History.go")}}</p>
+
+<h2 id="See_also" name="See_also">関連情報</h2>
+
+<ul>
+ <li>{{domxref("History")}}</li>
+ <li>{{DOMxRef("History.back","back()")}}</li>
+ <li>{{DOMxRef("History.forward","forward()")}}</li>
+ <li>{{event("popstate")}} event</li>
+ <li><a href="/ja/docs/Web/API/History_API/Working_with_the_History_API">History API での作業</a></li>
+</ul>