zoukankan      html  css  js  c++  java
  • 判断pc浏览器和手机浏览器方法

    //平台、设备和操作系统
            var system = {
                win: false,
                mac: false,
                xll: false,
                ipad:false
            };
            //检测平台
            var p = navigator.platform;
            system.win = p.indexOf("Win") == 0;
            system.mac = p.indexOf("Mac") == 0;
            system.x11 = (p == "X11") || (p.indexOf("Linux") == 0);
            system.ipad = (navigator.userAgent.match(/iPad/i) != null)?true:false;
            //跳转语句,如果是手机访问就自动跳转到wap.baidu.com页面
            if (system.win || system.mac || system.xll||system.ipad) {  
                
            } else {
                window.location.href = "http://www.baidu.com";
            }

            //平台、设备和操作系统
            var system = {
                win: false,
                mac: false,
                xll: false,
                ipad:false
            };
            //检测平台
            var p = navigator.platform;
            system.win = p.indexOf("Win") == 0;
            system.mac = p.indexOf("Mac") == 0;
            system.x11 = (p == "X11") || (p.indexOf("Linux") == 0);
            system.ipad = (navigator.userAgent.match(/iPad/i) != null)?true:false;
           
            if (system.win || system.mac || system.xll||system.ipad) {  
               
            } else {
                var weixin =new is_weixn;
            }
            function is_weixn(){
                var ua = navigator.userAgent.toLowerCase();
                if(ua.match(/MicroMessenger/i)=="micromessenger") {
                    return true;
                } else {
                    jQuery(document).ready(function($){
                       login();
                    })
                }
            }
            function login(){
                var obj = new WxLogin({
                    id: "code",
                    appid: appid,
                    scope: "snsapi_login",
                    redirect_uri: "http%3a%2f%2fwww.caiex.com%2fCAIEX-GAME%2floginController%2floginFallsGame.shtml%3fpageName%3d55",
                    state: randomString(6),
                    style: "black",
                    href: ""
                });
                $('.theme-popover-mask').fadeIn(100);
                $('.theme-popover').slideDown(200);
            }

  • 相关阅读:
    北京 到 娄底 灌湄
    AVR--IO设置编程
    AVR--I/O端口寄存器
    AVR--IO结构分析
    虚拟机VM下 UBUNTU 下安装Mantis
    Windows环境下Mantis搭建概述
    SW4STM32 : Error message from debugger back end: Error erasing flash with vFlashErase packet Error erasing flash with vFlashErase packet
    三极管驱动继电器详解
    STM32 Bootloader 跳转到App
    (转载) STM32IAP升级---IAP升级功能编写初期的一些困惑与疑问---完成功能后的总结
  • 原文地址:https://www.cnblogs.com/happiness-mumu/p/6023245.html
Copyright © 2011-2022 走看看