History back() Method
1 2 3 4 5 6 7 |
<button onclick="goBack()">Go Back</button> <script> function goBack() { window.history.back(); } </script> |
1 |
<a href="javascript:window.history.back()">ย้อนกลับ</a> |
History go() Method
1 2 3 4 5 6 7 |
<button onclick="goBack()">Go Back 2 Pages</button> <script> function goBack() { window.history.go(-2); } </script> |
1 |
<a href="javascript:window.history.go(-2);">ย้อนกลับ 2 สเต็ป</a> |
History forward() Method
1 2 3 4 5 6 7 |
<button onclick="goForward()">Go Forward</button> <script> function goForward() { window.history.forward(); } </script> |
History length Property
Get the number of URLs in the history list:
1 |
var x = history.length; |
ดูเพิ่มเติม
https://www.w3schools.com/jsref/obj_history.asp
ป้ายกำกับ:back(), forward(), go(), Javascript History Object, length