// Browser environment sniffing
var inBrowser = typeof window !== 'undefined';
// Weex 是使用流行的 Web 开发体验来开发高性能原生应用的框架
var inWeex = typeof WXEnvironment !== 'undefined' && !!WXEnvironment.platform;
// 两个不等号的含义有值取值,没值就是false 类似于  var  a = 'b' || false
var weexPlatform = inWeex && WXEnvironment.platform.toLowerCase();
// 浏览器的用户代理报头:window.navigator.userAgent
var UA = inBrowser && window.navigator.userAgent.toLowerCase(); 
var isIE = UA && /msie|trident/.test(UA);
var isIE9 = UA && UA.indexOf('msie 9.0') > 0;
var isEdge = UA && UA.indexOf('edge/') > 0;
var isAndroid = (UA && UA.indexOf('android') > 0) || (weexPlatform === 'android');
var isIOS = (UA && /iphone|ipad|ipod|ios/.test(UA)) || (weexPlatform === 'ios');
var isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge;
var isPhantomJS = UA && /phantomjs/.test(UA);
var isFF = UA && UA.match(/firefox\/(\d+)/);

 

相关文章:

  • 2021-07-05
  • 2022-12-23
  • 2021-10-15
  • 2021-08-06
  • 2021-12-26
  • 2022-12-23
  • 2022-02-11
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-05-24
  • 2022-12-23
相关资源
相似解决方案