Window History 对象
Window History 对象
History 对象包含用户(在浏览器窗口中)访问过的 URL。
History 对象是 window 对象的属性。
History 对象通过以下方式访问:
window.history
或仅用 history
:
实例
let length = window.history.length;
let length = history.length;
History 对象属性和方法
属性/方法 | 描述 |
---|---|
back() | 加载历史列表中的上一个 URL(页面)。 |
forward() | 加载历史列表中的下一个 URL(页面)。 |
go() | 从历史列表中加载特定的 URL(页面)。 |
length | 返回历史列表中的 URL(页面)数量。 |