Movatterモバイル変換


[0]ホーム

URL:


MDN Web Docs

Window: history property

BaselineWidely available

TheWindow.history read-only property returns a reference to theHistory object, which provides an interface for manipulating the browsersession history (pages visited in the tab or frame that the current page is loaded in).

SeeManipulating the browser history for examples and details. In particular, that article explains security features of thepushState() andreplaceState() methods that you should be aware of before using them.

Value

A reference to theHistory object.

Examples

js
history.back(); // equivalent to clicking back buttonhistory.go(-1); // equivalent to history.back();

Notes

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

For security reasons theHistory object doesn't allow the non-privileged code to access theURLs of other pages in the session history, but it does allow it to navigate the session history.

There is no way to clear the session history or to disable the back/forward navigation from unprivileged code. The closest available solution is thelocation.replace() method, which replaces the current item of the session history with the provided URL.

Specifications

Specification
HTML
# the-history-interface

Browser compatibility

Help improve MDN

Learn how to contribute.

This page was last modified on byMDN contributors.


[8]ページ先頭

©2009-2025 Movatter.jp