zoukankan      html  css  js  c++  java
  • 点击手机自带返回键,指定返回的内容//阻止安卓自带后退//禁止浏览器后退

    
    
    //禁止浏览器后退
    window.history.forward(1);
    
    
    
        第一种
    pushHistory(); function pushHistory() {
    var state = { title: "title", url: "__MODULE__/Index/index" }; window.history.pushState(state, "title", "__MODULE__/Index/index"); } window.addEventListener("popstate", function(e) { $('.order').show(); $('.mask222').hide(); $("#vehicle_Select_List").css('display', 'none'); }, false);
    第二种 
    pushHistory(); window.addEventListener(
    "popstate", function(e) { $('.order2').show(); $("#userSelectMap").animate({ left:"100%", },100); $("#nearDiv").animate({ left:"100%", },100); // $("#userSelectMap").hide(); // return false; // $(window).unbind('scroll'); window.location.href="indexNext.html" }, false); function pushHistory() { var state = { title: "title", url: "#" }; window.history.pushState(state, "title", "#"); } document.addEventListener("WeixinJSBridgeReady",function(){ WeixinJSBridge.call("showToolbar")});

    // 防止页面后退//阻止安卓机后退
    // 页面载入时使用pushState插入一条历史记录
    history.pushState(null, null, '#' );
    console.log('刷新');
    window.addEventListener('popstate', function(event) {
    console.log('回退');
    // 点击回退时再向历史记录插入一条,以便阻止下一次点击回退
    history.pushState(null, null, '#' );
    });

  • 相关阅读:
    class的方式创建组件
    function创建组件
    JSX语法
    React开发
    特征的标准化和归一化
    GSpan-频繁子图挖掘算法
    Linux下的ASLR(PIE)内存保护机制
    Linux下利用Ret2Libc绕过DEP
    通过fork进程爆破canary
    通过格式化字符串漏洞绕过canary
  • 原文地址:https://www.cnblogs.com/yongwang/p/6824582.html
Copyright © 2011-2022 走看看