How to use the bowser._detect function in bowser

To help you get started, we’ve selected a few bowser examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github RTCEngine / RTCEngine-js-sdk / lib / device.js View on Github external
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))
github robinweser / inline-style-prefixer / modules / utils / getBrowserInformation.js View on Github external
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) {
github Normally / vue-device / source / components / Device.vue View on Github external
setSize() {
      this.bowser = bowser._detect(window.navigator.userAgent)
      this.height = window.innerHeight
      this.width = window.innerWidth
    },
  },
github buildo / react-components / src / BrowserDetector / BrowserDetector.tsx View on Github external
detectBrowser(userAgent: string): BrowserDetector.DetectedBrowser {
    return bowser._detect(userAgent);
  }
github dvhb / badbrowser / src / lib / badbrowser.js View on Github external
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',
github buildo / react-components / src / BrowserDetector / BrowserDetector.js View on Github external
  detectBrowser = (userAgent) => bowser._detect(userAgent);
github robinweser / inline-style-prefixer / modules / utils / getBrowserInformation.js View on Github external
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)
github codex-team / hawk / hawk / routes / catcher / client.js View on Github external
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';
github SUI-Components / sui / packages / sui-js / src / ua-parser / index.js View on Github external
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)
  }
}