$(document).ready(function(e) {
            var counter = 0;
            if (window.history && window.history.pushState) {
            window.onpopstate = function () {
                        window.history.pushState('forward', null, '#');
                        window.history.forward(1);
                        alert("不可回退");
                    };
            }
            window.history.pushState('forward', null, '#'); //在IE中必须得有这两行
            window.history.forward(1);
});

js 捕获浏览器后退事件的更多相关文章

  1. js捕捉浏览器关闭事件-兼容几乎所有浏览器

    很多时候我们都在困扰,如何捕获浏览器关闭事件,网上虽然有很多方法,但都不理想,后来终于找到了一个很好地实现方法,大家可以试试哦,支持几乎所有的浏览器 <script type="tex ...

  2. js关闭浏览器窗口事件

    js关闭浏览器窗口 js关闭浏览器窗口,不弹出提示框.支持ie6+,火狐,谷歌等浏览器. <html> <head /> <body> <script typ ...

  3. js 跨浏览器实现事件

    我们知道不同的浏览器实现事件是不同的,就比如说我们常见的有三种方法: 1,dom0处理事件的方法,以前的js处理事件都是这样写的. (function () { var p=document.getE ...

  4. js 监控浏览器关闭事件

    代码如下: <!DOCTYPE html> <html> <head> <title>监控浏览器关闭事件</title> </head ...

  5. js 监听后退事件及跳转页面

    //直接跳转 window.location.href="b.html"; //返回上一级页面 window.history.back(-1); //返回下一级页面 window. ...

  6. js监听浏览器后退事件

    $(document).ready(function(e) {             var counter = 0;            if (window.history && ...

  7. js阻止浏览器默认事件

    1.阻止浏览器的默认行为 function stopDefault(e) { //如果提供了事件对象,则这是一个非IE浏览器 if(e && e.preventDefault) { / ...

  8. js屏蔽浏览器默认事件

    <!DOCTYPE html> <html> <head lang="en"> <meta charset="UTF-8&quo ...

  9. js捕获页面回车事件

    1.javascript版 document.onkeyup = function (e) { if (window.event)//如果window.event对象存在,就以此事件对象为准 e = ...

随机推荐

  1. The Little Prince-12/02

    The Little Prince-12/02 What moves me so deeply, about this little prince who is sleeping here, is h ...

  2. 怎样从外网访问内网MongoDB数据库?

    本地安装了一个MongoDB数据库,只能在局域网内访问到,怎样从外网也能访问到本地的MongoDB数据库呢?本文将介绍具体的实现步骤. 1. 准备工作 1.1 安装并启动MongoDB数据库 默认安装 ...

  3. eval & sleep

    ltp-ddt can_loopback source 'functions.sh'; interface='can0'; bitrate=; do_cmd "do_can_loopback ...

  4. java.lang.IllegalStateException: Failed to check the status of the service

    java.lang.IllegalStateException: Failed to check the status of the service com.pinyougou.sellergoods ...

  5. pyglet StaticSource

    for i in range(10): self.player2.queue(pyglet.media.StaticSource(pyglet.media.load('2.mp3')))

  6. Centos下搭建golang环境

    一.下载安装包 先查看一下我的Centos版本,这里是6.4. # cat /etc/redhat-release CentOS release 6.4 (Final) 去go语言中文社区下载想要下载 ...

  7. django模板常用过滤器—add、cut、date

    语法格式:{{  obj | filter:para  }} add过滤器:将两个数相加或字符串.列表等进行拼接 views.py def add(request): context={'l1':[1 ...

  8. The address where a.out.debug has been loaded is missing以及No symbol "*" in current context原因与解决方法

    最近,在debug core的时候,发现p 变量的时候提示“No symbol "*" in current context”,我们的代码使用-g编译的,经查有可能是下列几个原因或 ...

  9. 教你用Visual Studio Code做PHP开发 - 微软官方工具,IDE中的黑马

    转载于:http://bbs.wfun.com/thread-902655-1-1.html,仅供自己备忘 本文为我在智机网的原创  ] 关于Visual Studio Code,可能有的开发者很陌生 ...

  10. vue 起步

    vue 官网 目前最火的前端框架当属Vue.js了,很多使用过vue的程序员这样评价它,“vue.js兼具angular.js和react.js的优点,并剔除了它们的缺点”.授予了这么高的评价的vue ...