• DOM_事件


     

    没有后退按钮

    可以往前跳转

    获取浏览器类型版本

     

    <!doctype html>

    <html lang="en">

    <head>                                     

             <meta charset="UTF-8">

             <title>Navigator</title>

    </head>

    <body>

             <script>

           //console.log(navigator.userAgent);

           // 判断浏览器

           function getBrowser(){

               var explorer = navigator.userAgent,browser;

               if(explorer.indexOf("MSIE")>-1){

                  browser = "IE";

               }else if(explorer.indexOf("Chrome")>-1){

                  browser = "Chrome";

               }else if(explorer.indexOf("Opera")>-1){

                  browser = "Opera";

               }else if(explorer.indexOf("Safari")>-1){

                  browser = "Safari";

               }

               return browser;

           }

           var browser = getBrowser();

           console.log("您当前使用的浏览器是:"+browser);

           // 判断终端

           function isPc(){

              var userAgentInfo = navigator.userAgent,

                  Agents = ["Andriod","iPhone","symbianOS","windows phone","iPad","iPod"],

                  flag = true,i;

                  console.log(userAgentInfo);

               for(i=0;i<Agents.length;i++){

                  if(userAgentInfo.indexOf(Agents[i])>-1){

                     flag = false;

                     break;

                  }

               }

               return flag;

           }

           var isPcs = isPc();

           console.log(isPcs);

             </script>

    </body>

    </html>

  • 相关阅读:
    BKDRHash函数
    poj3261Milk Patterns 后缀数组
    两圆相交面积
    后缀数组模板
    kmp模板 && 扩展kmp模板
    hdu 2594 Simpsons’ Hidden Talents
    BZOJ 1911 特别行动队(斜率优化DP)
    BZOJ 1898 沼泽鳄鱼(矩阵快速幂)
    BZOJ 1996 合唱队(DP)
    BZOJ 1821 部落划分(二分+并查集)
  • 原文地址:https://www.cnblogs.com/barryliang/p/8733306.html
Copyright © 2020-2023  润新知