Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
static _detect()
{
const ua = global.navigator.userAgent
const browser = bowser._detect(ua)
DeviceManager._detected = true
DeviceManager._flag = undefined
DeviceManager._name = browser.name || 'unknow browser'
DeviceManager._version = browser.version || 'unknow version'
DeviceManager._browser = browser
DeviceManager._supported = false
// Chrome, Chromium (desktop and mobile).
if (bowser.check({ chrome: '55' }, true, ua))
{
DeviceManager._flag = 'chrome'
DeviceManager._supported = true
}
// Firefox (desktop and mobile).
else if (bowser.check({ firefox: '50' }, true, ua))
export default function getBrowserInformation(
userAgent: string
): Object | boolean {
let browserInfo = bowser._detect(userAgent)
if (browserInfo.yandexbrowser) {
browserInfo = bowser._detect(userAgent.replace(/YaBrowser\/[0-9.]*/, ''))
}
for (const browser in prefixByBrowser) {
if (browserInfo.hasOwnProperty(browser)) {
const prefix = prefixByBrowser[browser]
browserInfo.jsPrefix = prefix
browserInfo.cssPrefix = `-${prefix.toLowerCase()}-`
break
}
}
browserInfo.browserName = getBrowserName(browserInfo)
// For cordova IOS 8 the version is missing, set truncated osversion to prevent NaN
if (browserInfo.version) {
setSize() {
this.bowser = bowser._detect(window.navigator.userAgent)
this.height = window.innerHeight
this.width = window.innerWidth
},
},
detectBrowser(userAgent: string): BrowserDetector.DetectedBrowser {
return bowser._detect(userAgent);
}
constructor({
userAgent,
supported = {},
unsupported = {},
ignoreChoice = false,
fullscreen = true,
logo = false,
path = false,
} = {}) {
this._userAgent = userAgent || navigator.userAgent;
this._bowser = bowser;
this.detectedBrowser = bowser._detect(this._userAgent);
this.settings = extend(
{
template: null,
path: false,
fullscreen: true,
ignoreChoice: false,
logo: false,
supported: {
chrome: '42',
chromium: '42',
firefox: '38',
msie: '9',
msedge: '12',
opera: '26',
safari: '6',
detectBrowser = (userAgent) => bowser._detect(userAgent);
export default function getBrowserInformation(
userAgent: string
): Object | boolean {
let browserInfo = bowser._detect(userAgent)
if (browserInfo.yandexbrowser) {
browserInfo = bowser._detect(userAgent.replace(/YaBrowser\/[0-9.]*/, ''))
}
for (const browser in prefixByBrowser) {
if (browserInfo.hasOwnProperty(browser)) {
const prefix = prefixByBrowser[browser]
browserInfo.jsPrefix = prefix
browserInfo.cssPrefix = `-${prefix.toLowerCase()}-`
break
}
}
browserInfo.browserName = getBrowserName(browserInfo)
let detect = function (ua) {
let bowser = require('bowser')._detect(ua);
let getRenderingEngine = function () {
if (bowser.webkit) return 'Webkit';
if (bowser.blink) return 'Blink';
if (bowser.gecko) return 'Gecko';
if (bowser.msie) return 'MS IE';
if (bowser.msedge) return 'MS Edge';
return undefined;
};
let getOs = function () {
if (bowser.mac) return 'MacOS';
if (bowser.windows) return 'Windows';
if (bowser.windowsphone) return 'Windows Phone';
if (bowser.linux) return 'Linux';
export const stats = userAgent => {
const ua = bowser._detect(userAgent)
return {
isMobile: Boolean(ua.mobile),
osName: ua.osname,
browserName: ua.name,
browserVersion: ua.version,
isTablet: Boolean(ua.tablet)
}
}