zoukankan      html  css  js  c++  java
  • 是否手机访问

    public static Boolean IsMobileDevice()
    {
    string[] mobileAgents = { "iphone", "android", "phone", "mobile", "wap", "netfront", "java", "opera mobi", "opera mini", "ucweb", "windows ce", "symbian", "series", "webos", "sony", "blackberry", "dopod", "nokia", "samsung", "palmsource", "xda", "pieplus", "meizu", "midp", "cldc", "motorola", "foma", "docomo", "up.browser", "up.link", "blazer", "helio", "hosin", "huawei", "novarra", "coolpad", "webos", "techfaith", "palmsource", "alcatel", "amoi", "ktouch", "nexian", "ericsson", "philips", "sagem", "wellcom", "bunjalloo", "maui", "smartphone", "iemobile", "spice", "bird", "zte-", "longcos", "pantech", "gionee", "portalmmm", "jig browser", "hiptop", "benq", "haier", "^lct", "320x320", "240x320", "176x220", "w3c ", "acs-", "alav", "alca", "amoi", "audi", "avan", "benq", "bird", "blac", "blaz", "brew", "cell", "cldc", "cmd-", "dang", "doco", "eric", "hipt", "inno", "ipaq", "java", "jigs", "kddi", "keji", "leno", "lg-c", "lg-d", "lg-g", "lge-", "maui", "maxo", "midp", "mits", "mmef", "mobi", "mot-", "moto", "mwbp", "nec-", "newt", "noki", "oper", "palm", "pana", "pant", "phil", "play", "port", "prox", "qwap", "sage", "sams", "sany", "sch-", "sec-", "send", "seri", "sgh-", "shar", "sie-", "siem", "smal", "smar", "sony", "sph-", "symb", "t-mo", "teli", "tim-", "tosh", "tsm-", "upg1", "upsi", "vk-v", "voda", "wap-", "wapa", "wapi", "wapp", "wapr", "webc", "winw", "winw", "xda", "xda-", "Googlebot-Mobile" };
    var request = HttpContext.Current.Request;
    return mobileAgents.Any(t => request.UserAgent != null && request.UserAgent.ToString().ToLower().IndexOf(t, StringComparison.Ordinal) >= 0);
    }

  • 相关阅读:
    Python 不同数据类型比较
    计算机外语收集
    d3.js学习-联系力学图
    d3.js学习11
    d3.js学习10
    d3.js学习9
    d3.js学习8
    [springboot jpa] [bug] Could not open JPA EntityManager for transaction
    [spring cloud feign] [bug] 使用对象传输get请求参数
    [ethereum源码分析](5) 创建新账号
  • 原文地址:https://www.cnblogs.com/cunfu/p/6544045.html
Copyright © 2011-2022 走看看