html防止退回到上一个页面

wuxincong / 2024-01-10 / 原文

<script language="javascript">
//防止页面后退
history.pushState(null, null, document.URL);
window.addEventListener('popstate', function () {
history.pushState(null, null, document.URL);
});
</script>