blob: a9a4923bd78af2d2d326737c49332b9e8918681f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
|
---
title: History.scrollRestoration
slug: Web/API/History/scrollRestoration
tags:
- API
- HTML DOM
- History API
- Property
- Reference
translation_of: Web/API/History/scrollRestoration
---
<div>{{APIRef("HTML DOM")}}</div>
<p><strong><code>History.scrollRestoration</code></strong> 속성을 사용하면 기록 탐색 시 사용할 스크롤 위치 복원 기능의 기본값을 웹 애플리케이션이 지정할 수 있습니다.</p>
<h2 id="구문">구문</h2>
<pre class="syntaxbox">let scrollRestore = history.scrollRestoration;</pre>
<h3 id="값">값</h3>
<dl>
<dt><code>"auto"</code></dt>
<dd>페이지 내에서 사용자의 스크롤이 위치했던 장소로 복원합니다.</dd>
<dt><code>"manual"</code></dt>
<dd>스크롤을 복원하지 않습니다. 사용자가 직접 스크롤해야 합니다.</dd>
</dl>
<h2 id="예제">예제</h2>
<h3 id="현재_스크롤_복원_여부_알아내기">현재 스크롤 복원 여부 알아내기</h3>
<pre class="brush: js">const scrollRestoration = history.scrollRestoration
if (scrollRestoration === 'manual') {
console.log('The location on the page is not restored, user will need to scroll manually.');
}
</pre>
<h3 id="스크롤_복원_비활성화">스크롤 복원 비활성화</h3>
<pre class="brush: js">if (history.scrollRestoration) {
window.history.scrollRestoration = 'manual';
}
</pre>
<h2 id="명세">명세</h2>
<table class="standard-table">
<tbody>
<tr>
<th scope="col">Specification</th>
<th scope="col">Status</th>
<th scope="col">Comment</th>
</tr>
<tr>
<td>{{SpecName("HTML WHATWG", " #scroll-restoration-mode", "History.scrollRestoration")}}</td>
<td>{{Spec2("HTML WHATWG")}}</td>
<td>No change from {{SpecName("HTML5 W3C")}}.</td>
</tr>
<tr>
<td>{{SpecName("HTML5 W3C", "browsers.html#dom-history-scrollrestoration", "History.scrollRestoration")}}</td>
<td>{{Spec2("HTML5 W3C")}}</td>
<td>Initial definition.</td>
</tr>
</tbody>
</table>
<h2 id="브라우저_호환성">브라우저 호환성</h2>
<p>{{Compat("api.History.scrollRestoration")}}</p>
|