我试过这样做,但它需要与屏幕交互才能工作,有没有办法使它在没有交互的情况下工作
history.pushState(null, document.title, location.href);
history.back();
history.forward();
window.onpopstate = function () {
history.go(1);
};
你是说禁用浏览器的后退按钮吗?
window.history.pushState(null, null, window.location.href);
window.onpopstate = function () { window.history.go(1); };