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';
        }
    
    });
    
  • 相关阅读:
    各种编译器
    C99特性
    动态内存分配
    MDK C++编程说明
    C++类的大小计算
    WPF DataGrid添加编号列
    WPF实现打印用户界面功能
    WPF DataGrid 导出Excel
    知识点总结
    Winfrom控件使用
  • 原文地址:https://www.cnblogs.com/jerrypig/p/10088192.html
Copyright © 2011-2022 走看看