前端开发,如何做到禁止页面后退

精华就是这几句!
history.pushState(null, null, document.URL);
window.addEventListener('popstate', function () {
  history.pushState(null, null, document.URL);
});
posted @ 2020-07-10 16:15  苹瑶  阅读(380)  评论(0)    收藏  举报