ประวัติ API
วัตถุประวัติหน้าต่าง
ออบเจ็กต์ประวัติประกอบด้วย URL ที่ผู้ใช้เข้าชม (ในหน้าต่างเบราว์เซอร์)
วัตถุประวัติเป็นคุณสมบัติของวัตถุหน้าต่าง
วัตถุประวัติสามารถเข้าถึงได้ด้วย:
window.history
หรือเพียงแค่history
:
ตัวอย่าง
let length = window.history.length;
let length = history.length;
คุณสมบัติของออบเจ็กต์ประวัติ
Property | Description |
---|---|
length | Returns the number of URLs (pages) in the history list |
วิธีการวัตถุประวัติ
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 |