help.js 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. //application/vnd.chromium.remoting-viewer 可能为360特有 通过_mine判断是否是360
  2. export function isBrowser() {
  3. var agent = navigator.userAgent.toLowerCase()
  4. console.log(agent)
  5. System = function () {
  6. if (agent.indexOf('qqbrowser') > 0) {//判断是qq浏览器还是其它浏览器
  7. return "qq浏览器"
  8. }
  9. if (agent.indexOf("se 2.x") > 0) {
  10. return "搜狗浏览器"
  11. }
  12. var is360 = _mime("type", "application/vnd.chromium.remoting-viewer");
  13. if (is360) {
  14. return "360浏览器"
  15. }
  16. //检测是否是谷歌内核(可排除360及谷歌以外的浏览器)
  17. //测试mime
  18. function _mime(option, value) {
  19. var mimeTypes = navigator.mimeTypes;
  20. console.log(mimeTypes)
  21. for (var mt in mimeTypes) {
  22. if (mimeTypes[mt][option] == value) {
  23. return true;
  24. }
  25. }
  26. return false;
  27. }
  28. if (agent.indexOf("chrome") > 0) {
  29. return 'chrome'
  30. }
  31. }
  32. let s = System()
  33. if(s){
  34. return s
  35. }
  36. if (agent.indexOf('firefox') > 0) {
  37. return "firefox浏览器"
  38. }
  39. if (agent.indexOf('trident') > 0) {
  40. return "IE浏览器"
  41. }
  42. if (agent.indexOf("safari") > 0 && agent.indexOf("chrome") < 0) {
  43. return 'Safari'
  44. }
  45. }