ifApp.js 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. "use strict";
  2. const browser = {
  3. versions: function() {
  4. let u = navigator.userAgent;
  5. return {
  6. trident: u.indexOf("Trident") > -1,
  7. //IE内核
  8. presto: u.indexOf("Presto") > -1,
  9. //opera内核
  10. webKit: u.indexOf("AppleWebKit") > -1,
  11. //苹果、谷歌内核
  12. gecko: u.indexOf("Gecko") > -1 && u.indexOf("KHTML") == -1,
  13. //火狐内核
  14. mobile: !!u.match(/AppleWebKit.*Mobile.*/),
  15. //是否为移动终端
  16. ios: !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/),
  17. //ios终端
  18. android: u.indexOf("Android") > -1 || u.indexOf("Adr") > -1 || u.indexOf("Linux") > -1,
  19. //android终端
  20. iPhone: u.indexOf("iPhone") > -1,
  21. //是否为iPhone或者QQHD浏览器
  22. iPad: u.indexOf("iPad") > -1,
  23. //是否iPad
  24. webApp: u.indexOf("Safari") == -1,
  25. //是否web应该程序,没有头部与底部
  26. weixin: u.indexOf("MicroMessenger") > -1,
  27. //是否微信 (2015-01-22新增)
  28. qq: u.match(/\sQQ/i) == " qq",
  29. //是否QQ
  30. browser: navigator.userAgent.indexOf("MQQBrowser") > -1
  31. };
  32. }(),
  33. language: (navigator.browserLanguage || navigator.language).toLowerCase()
  34. };
  35. exports.browser = browser;
  36. //# sourceMappingURL=../../.sourcemap/mp-weixin/utils/ifApp.js.map