webapp禁止浏览器返回上一页;这个功能可以用在,当一段程序走到末尾的时候,之前的操作不允许被修改,所以不能返回上一页,只能选择关闭这个程序,代码如下
<script language="javascript">
//防止页面后退
history.pushState(null, null, document.URL);
window.addEventListener('popstate', function () {
history.pushState(null, null, document.URL);
});
</script>