一、幾種方法:瀏覽器
window.history.go(-1); //返回上一頁
window.history.back(); //返回上一頁
//若是要強行刷新的話就是:window.history.back();
//刷新當前頁 window.location.reload();
window.location.go(-1); //刷新上一頁io
二、獲取瀏覽器紀錄scroll
window.history方法
輸出:
History {length: 4, scrollRestoration: "auto", state: {…}}length: 4scrollRestoration: "auto"state: {key: "10549.050"}key: "10549.050"__proto__: Object__proto__: Historyhistory