原生js代码
<script type="text/javascript">
//禁用浏览器返回按钮
function banBack() {
history.pushState(null, null, document.URL);
window.addEventListener("popstate", function() {
history.pushState(null, null, document.URL);
});
}
window.onload = function() {
banBack();
}
</script>
说明: 使用时将代码放入script片段中即可(只对当前页面有效)