$(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. 每日linux命令学习-sed

    Linux的文本处理实用工具主要由sed和awk命令,二者虽然略有差异,但都使用正则表达式,默认使用标准I/O,并且使用管道命令可以将前一个命令的输出作为下一个命令的输入.笔者将在本节学习sed命令. ...

  2. Git 常用命令列表

    1 常用 $ git remote add origin git@github.com:yeszao/dofiler.git # 配置远程git版本库 $ git pull origin master ...

  3. django 上传文件及反馈信息

    from django.shortcuts import render,HttpResponse from django.views import View from Fiskars.models i ...

  4. Web前端学习笔记之离线安装npm

    0x00 概述 这段时间的工作主题就是Linux 下的“离线部署”,包括mongo.mysql.postgresql.nodejs.nginx等软件的离线部署.平常在服务器上借助apt-get就能轻松 ...

  5. ORA-00600: internal error code, arguments: [13030], [20]一例解决

    两年没有接触oracle了,中午,一环境update from的时候出现ORA-00600: internal error code, arguments: [13030], [20]异常,经查,官网 ...

  6. account_log,pay_log,user_account 三个表的用途与区别

    mysql> DESC zbphp.com_account_log; +--------------+-----------------------+------+-----+--------- ...

  7. Django模版语言的复用 1. include标签--模版导入 2.inclusion_tag自定义标签--模版导入 3.母版

    include标签--模版导入 ''' 前提:项目中,往往会出现多个页面拥有一个或几个相同的页面版块,或是一个页面多个页面版块是相同的 如何运用:可以将多个样式标签的集合进行封装,对外提供版块的名字( ...

  8. Objective-C 【init/initWithFrame调用机制】

    这是一个自定义view: @implementation MyView - (instancetype)init { if (self = [super init]) { NSLog(@"调 ...

  9. FFmpeg:视频转码、剪切、合并、播放速调整

    原文:https://fzheng.me/2016/01/08/ffmpeg/ FFmpeg:视频转码.剪切.合并.播放速调整 2016-01-08 前阵子帮导师处理项目 ppt,因为插入视频的格式问 ...

  10. bitset,2018蓝桥杯-明码(二进制转换)

    bitset可以存储二进制数位 bitset<8> x(2); cout<<x<<endl; //输出:00000010 #include <iostream ...