mirror of https://github.com/dnomd343/sub-web
CareyWong
5 years ago
2 changed files with 21 additions and 0 deletions
@ -0,0 +1,20 @@ |
|||
import Vue from 'vue' |
|||
|
|||
Vue.prototype.$getOS = () => { |
|||
let ua = navigator.userAgent, |
|||
isWindowsPhone = /(?:Windows Phone)/.test(ua), |
|||
isSymbian = /(?:SymbianOS)/.test(ua) || isWindowsPhone, |
|||
isAndroid = /(?:Android)/.test(ua), |
|||
isFireFox = /(?:Firefox)/.test(ua), |
|||
// isChrome = /(?:Chrome|CriOS)/.test(ua),
|
|||
isTablet = /(?:iPad|PlayBook)/.test(ua) || (isAndroid && !/(?:Mobile)/.test(ua)) || (isFireFox && /(?:Tablet)/.test(ua)), |
|||
isIPhone = /(?:iPhone)/.test(ua) && !isTablet, |
|||
isPc = !isIPhone && !isAndroid && !isSymbian && !isWindowsPhone; |
|||
|
|||
return { |
|||
isTablet: isTablet, |
|||
isIPhone: isIPhone, |
|||
isAndroid: isAndroid, |
|||
isPc: isPc |
|||
}; |
|||
} |
Loading…
Reference in new issue