zoukankan      html  css  js  c++  java
  • 判断浏览器环境(QQ,微信,安卓设备,IOS设备,PC微信环境,移动设备)


    判断浏览器环境(QQ,微信,安卓设备,IOS设备,PC微信环境,移动设备)

    
    //  ===== 判断浏览器环境 =====  // 
    
    // 判断是否是QQ环境
    function isQQ() {
    	return(navigator.userAgent.toLowerCase().match(/qq/i) == "qq")
    }
    
    // 判断是否是微信环境
    function isWeixin() {
    	return(navigator.userAgent.toLowerCase().match(/MicroMessenger/i) == "micromessenger")
    }
    
    // 判断是否是安卓设备
    function isAndroid() {
    	return navigator.userAgent.indexOf("Android") > -1 || navigator.userAgent.indexOf("Linux") > -1
    }
    
    // 判断是否是IOS设备
    function isiOS() {
    	return !!navigator.userAgent.match(/(i[^;]+;( U;)? CPU.+Mac OS X/)
    }
    
    // 判断是否是PC微信环境
    function isPCWeixin() {
    	return(navigator.userAgent.toLowerCase().match(/WindowsWechat/i) == "windowswechat")
    }
    
    // 是否是移动设备
    function isMobile() {
    	for(var c = navigator.userAgent.toLowerCase(), b = "android;iphone;symbianos;windows phone;ipad;ipod".split(";"), a = 0; a < b.length; a++)
    		if(0 < c.indexOf(b[a])) return !0;
    	return !1
    }
    
    
  • 相关阅读:
    #2019090700004
    51nod 1191-贪心+并查集
    hdu 5015-矩阵快速幂
    树形DP—依赖背包模板
    HDU 1074—压缩DP
    动态绑定的开销
    动态绑定
    静态绑定(前期绑定)
    继承的一些优点
    多态置换原则初始化基类对象
  • 原文地址:https://www.cnblogs.com/lalalagq/p/10207761.html
Copyright © 2011-2022 走看看