zoukankan      html  css  js  c++  java
  • 手机端判断安卓,iso,微信

    var uaContains = function (key) {
        return navigator.userAgent.toLowerCase().indexOf(key.toLowerCase()) >= 0;
    };
    // can't just try "Android" as it might catch Windows Phone
    var ANDROID = ['Linux', 'Android'].every(uaContains);
    // can't just try "iPhone" as it might catch Windows Phone
    var IOS = ['(iPhone;', '(iPod touch;', '(iPad;', '(iPod;'].some(uaContains);
    
    var useragent = navigator.userAgent.toLowerCase();
    var isWeixin = /micromessenger/i.test(useragent);
    if (!IOS) {
        document.getElementById('android').style.display = 'block';
        document.getElementById('ios').style.display = 'none';
    }
    
    var androidBTN = document.getElementById('android');
    androidBTN.addEventListener('click', function (e) {
        if (isWeixin && ANDROID) {
            document.getElementById('tipDiv').style.display = 'block';
            document.getElementById('tipimg').style.display = 'block';
            document.getElementById('tipDiv').style.height = document.documentElement.scrollHeight + 'px';
        }
    
    });
    
  • 相关阅读:
    JZOJ5809 数羊
    P3313 [SDOI2014]旅行
    2019.10.22 NOIP模拟测试 day2
    P4322 [JSOI2016]最佳团体
    P1850 换教室
    P3225 [HNOI2012]矿场搭建
    P2607 [ZJOI2008]骑士
    2019.10.21 NOIP模拟测试 day1
    AFO
    禁止加载浏览器图片
  • 原文地址:https://www.cnblogs.com/jerrypig/p/10088192.html
Copyright © 2011-2022 走看看