这里使用了jquery,先引入jquery
<script src="http://libs.baidu.com/jquery/2.0.0/jquery.js"></script>
function disableBack() {
if (window.history && window.history.pushState) {
$(window).on('popstate', function () {
window.history.pushState('forward', null, '');
window.history.forward(1);
});
}
window.history.pushState('forward', null, '');
window.history.forward(1);
}
原文:https://www.cnblogs.com/xl5230/p/11572344.html