zoukankan      html  css  js  c++  java
  • 各个端类型判断

    const ua = navigator.userAgent;
    this.ua = ua;
    this.trident = ua.indexOf('Trident') > -1; // ie
    this.presto = ua.indexOf('Presto') > -1; // opera
    this.webKit = ua.indexOf('AppleWebKit') > -1; // applewebkit
    this.gecko = ua.indexOf('Gecko') > -1 && ua.indexOf('KHTML') == -1; // firefox
    this.mobile = !!ua.match(/AppleWebKit.*Mobile.*/); // mobile
    this.ios = !!ua.match(/(i[^;]+;( U;)? CPU.+Mac OS X/); // ios
    this.android = ua.indexOf('Android') > -1 || ua.indexOf('Linux') > -1; // android or uc
    this.iphone = ua.indexOf('iPhone') > -1; // iphone or qq
    this.ipad = ua.indexOf('iPad') > -1; // ipad
    this.weibo = /weibo/i.test(ua) ? true : false;
    this.weixin = /micromessenger/i.test(ua) ? true : false;
    this.app = /jumei/i.test(navigator.userAgent) ? true : false;
    this.wkWebview = /WKWebView/1/g.test(ua) ? true : false;
    this.isHybrid = (window as any)._isHybrid

  • 相关阅读:
    Resharper Visual studio中的插件
    MVC 中Simditor上传本地图片
    MVC编程模型
    数据库面试题
    SQL、索引
    存储过程详解
    EF的简单认识
    MVC是什么
    AOP面向切面编程
    SQL语句基本
  • 原文地址:https://www.cnblogs.com/ganmy/p/9057086.html
Copyright © 2011-2022 走看看