防止浏览器回退js代码完美版
之前记录了一个方式,后来发现谷歌等浏览器不兼容,今天再记录一个兼容谷歌,ie,等多版本的防止绘图js代码
代码如下:
<script language="javascript"> $(function(){ 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); }) </script>
还没有评论,来说两句吧...