Lịch sử cửa sổ
Đối tượng Lịch sử Cửa sổ
Đối tượng lịch sử chứa các URL mà người dùng đã truy cập (trong cửa sổ trình duyệt).
Đối tượng lịch sử là một thuộc tính của đối tượng cửa sổ .
Đối tượng lịch sử được truy cập bằng:
window.history
hoặc chỉ history
:
Các ví dụ
let length = window.history.length;
let length = history.length;
Thuộc tính đối tượng lịch sử
Property | Description |
---|---|
length | Returns the number of URLs (pages) in the history list |
Phương pháp đối tượng lịch sử
Method | Description |
---|---|
back() | Loads the previous URL (page) in the history list |
forward() | Loads the next URL (page) in the history list |
go() | Loads a specific URL (page) from the history list |