aboutsummaryrefslogtreecommitdiff
path: root/files/ja/web/api/history/back/index.md
diff options
context:
space:
mode:
Diffstat (limited to 'files/ja/web/api/history/back/index.md')
-rw-r--r--files/ja/web/api/history/back/index.md89
1 files changed, 38 insertions, 51 deletions
diff --git a/files/ja/web/api/history/back/index.md b/files/ja/web/api/history/back/index.md
index 122d0f7351..6da8b3b07f 100644
--- a/files/ja/web/api/history/back/index.md
+++ b/files/ja/web/api/history/back/index.md
@@ -5,67 +5,54 @@ tags:
- API
- HTML DOM
- History
- - History API
- - Method
- - Reference
- - Web
+ - 履歴 API
+ - メソッド
+ - リファレンス
+ - ウェブ
+browser-compat: api.History.back
translation_of: Web/API/History/back
---
-<div>{{APIRef("History API")}}</div>
+{{APIRef("History API")}}
-<p><span class="seoSummary"><strong><code>History.back()</code></strong> メソッドは、ブラウザーにセッション履歴内で1つ前のページに戻らせます。</span>これは {{domxref("History.go", "history.go(-1)")}} を呼び出すのと同じ効果があります。1つ前のページがない場合、このメソッド呼び出しは何もしません。</p>
+**`History.back()`** メソッドは、ブラウザーにセッション履歴内で 1 つ前のページに戻らせます。
-<p>このメソッドは{{glossary("asynchronous", "非同期")}}です。移動が完了したときを検知したい場合は {{event("popstate")}} イベントのリスナーを追加してください。</p>
+これは {{domxref("History.go", "history.go(-1)")}} を呼び出すのと同じ効果があります。 1 つ前のページがない場合、このメソッド呼び出しは何もしません。
-<h2 id="Syntax" name="Syntax">構文</h2>
+このメソッドは{{glossary("asynchronous", "非同期")}}です。移動が完了したときを検知したい場合は {{domxref("Window/popstate_event", "popstate")}} イベントのリスナーを追加してください。
-<pre class="syntaxbox notranslate">history.back()</pre>
+## 構文
-<h2 id="Examples" name="Examples">例</h2>
+```js
+history.back()
+```
-<p>以下の短い例では、ページ上のボタンを押すとセッション履歴内の1つ前の項目に移動します。</p>
+## 例
-<h3 id="HTML">HTML</h3>
+以下の短い例では、ページ上のボタンを押すとセッション履歴内の 1 つ前の項目に移動します。
-<pre class="brush: html notranslate">&lt;button id="go-back"&gt;Go back!&lt;/button&gt;</pre>
+### HTML
-<h3 id="JavaScript">JavaScript</h3>
+```html
+<button id="go-back">Go back!</button>
+```
-<pre class="brush: js notranslate">document.getElementById('go-back').addEventListener('click', () =&gt; {
+### JavaScript
+
+```js
+document.getElementById('go-back').addEventListener('click', () => {
history.back();
-});</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#history", "History.back()")}}</td>
- <td>{{Spec2("HTML WHATWG")}}</td>
- <td>{{SpecName("HTML5 W3C")}} から変更なし</td>
- </tr>
- <tr>
- <td>{{SpecName("HTML5 W3C", "browsers.html#dom-history-back", "History.back()")}}</td>
- <td>{{Spec2("HTML5 W3C")}}</td>
- <td>初回定義</td>
- </tr>
- </tbody>
-</table>
-
-<h2 id="Browser_compatibility" name="Browser_compatibility">ブラウザーの互換性</h2>
-
-<p>{{Compat("api.History.back")}}</p>
-
-<h2 id="See_also" name="See_also">関連情報</h2>
-
-<ul>
- <li>{{domxref("History")}}</li>
- <li><a href="/ja/docs/Web/API/History_API/Working_with_the_History_API">History API での作業</a></li>
-</ul>
+});
+```
+
+## 仕様書
+
+{{Specifications}}
+
+## ブラウザーの互換性
+
+{{Compat}}
+
+## 関連情報
+
+- {{domxref("History")}}
+- [履歴 API での作業](/ja/docs/Web/API/History_API/Working_with_the_History_API)