diff options
Diffstat (limited to 'files/ko/web/api/history/state/index.html')
-rw-r--r-- | files/ko/web/api/history/state/index.html | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/files/ko/web/api/history/state/index.html b/files/ko/web/api/history/state/index.html new file mode 100644 index 0000000000..0f889665c7 --- /dev/null +++ b/files/ko/web/api/history/state/index.html @@ -0,0 +1,67 @@ +--- +title: History.state +slug: Web/API/History/state +translation_of: Web/API/History/state +--- +<div>{{APIRef("History API")}}</div> + +<p><span class="seoSummary"><strong><code>History.state</code></strong> 속성은 현 history에 해당하는 state값을 나타냅니다.</span></p> + +<p>{{event("popstate")}} 이벤트가 트리거될때가 아닌 상태에서 state값을 볼 수 있는 방법입니다.</p> + +<h2 id="문법">문법</h2> + +<pre class="syntaxbox">const <em>currentState</em> = history.state</pre> + +<h3 id="값">값</h3> + +<p>현 history에 위치한 값입니다. 이 값은 {{domxref("History.pushState","pushState()")}} 또는 {{domxref("History.replaceState","replaceState()")}}을 사용할때까지 {{jsxref("null")}} 값을 가집니다.</p> + +<h2 id="예제">예제</h2> + +<p><code>history.state</code> 로 초기값을 보여준 후 {{domxref("History.pushState","pushState()")}}를 사용하여 State를 푸시합니다.</p> + +<p>다음 코드 줄은 <code>history.state</code> 를 사용하여 콘솔에다 값이 푸시되었음을 보여줍니다.</p> + +<pre class="brush: js">// Should be null because we haven't modified the history stack yet +console.log(`History.state before pushState: ${history.state}`); + +// Now push something on the stack +history.pushState({name: 'Example'}, "pushState example", 'page3.html'); + +// Now state has a value. +console.log(`History.state after pushState: ${history.state}`);</pre> + +<h2 id="SpecificationsE">Specifications<a class="button section-edit only-icon" href="https://developer.mozilla.org/en-US/docs/Web/API/History$edit#Specifications" rel="nofollow, noindex"><span>E</span></a></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", "#dom-history-state", "History.state")}}</td> + <td>{{Spec2("HTML WHATWG")}}</td> + <td></td> + </tr> + <tr> + <td>{{SpecName("HTML5 W3C", "browsers.html#dom-history-state", "History.state")}}</td> + <td>{{Spec2("HTML5 W3C")}}</td> + <td>Initial definition.</td> + </tr> + </tbody> +</table> + +<h2 id="Browser_compatibility">Browser compatibility</h2> + + + +<p>{{Compat("api.History.state")}}</p> + +<h2 id="See_also">See also</h2> + +<ul> + <li><a href="/en-US/docs/Web/API/History_API/Working_with_the_History_API">Working with the History API</a></li> +</ul> |