How to use the detect-browser.version function in detect-browser

To help you get started, we’ve selected a few detect-browser 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 silverstripe / silverstripe-admin / client / src / lib / browserWarning.js View on Github external
/* global document */
import browser from 'detect-browser';

if (browser.name === 'ie' && parseInt(browser.version, 10) <= 10) {
  const warning = document.getElementById('browser-warning-wrapper');
  if (warning) {
    warning.className = `${warning.className} browser-warning-wrapper--incompatible`;
  }
}
github rtc-io / rtc-captureconfig / capabilities.js View on Github external
'use strict';

var browser = require('detect-browser');
var compareVersions = require('compare-versions')

var capabilities = module.exports = {
	moz: typeof navigator != 'undefined' && !!navigator.mozGetUserMedia,
	browser: browser.name,
	browserVersion: browser.version
};

// Mozilla constraings handling
if (capabilities.moz) {
	capabilities.constraintsType = (compareVersions(browser.version, '38.0.0') >= 0 ? 'standard' : 'legacy');
}
// Chrome constraints handling
else if (browser.name === 'chrome') {
	capabilities.constraintsType = (compareVersions(browser.version, '53.0.0') >= 0 ? 'standard' : 'legacy');
}
// Safari constraints handling
else if (browser.name === 'safari') {
	capabilities.constraintsType = (compareVersions(browser.version, '605.1.15') >= 0 ? 'standard' : 'legacy');
}
// Default constraints handling
else {
github rtc-io / rtc-captureconfig / capabilities.js View on Github external
moz: typeof navigator != 'undefined' && !!navigator.mozGetUserMedia,
	browser: browser.name,
	browserVersion: browser.version
};

// Mozilla constraings handling
if (capabilities.moz) {
	capabilities.constraintsType = (compareVersions(browser.version, '38.0.0') >= 0 ? 'standard' : 'legacy');
}
// Chrome constraints handling
else if (browser.name === 'chrome') {
	capabilities.constraintsType = (compareVersions(browser.version, '53.0.0') >= 0 ? 'standard' : 'legacy');
}
// Safari constraints handling
else if (browser.name === 'safari') {
	capabilities.constraintsType = (compareVersions(browser.version, '605.1.15') >= 0 ? 'standard' : 'legacy');
}
// Default constraints handling
else {
	capabilities.constraintsType = 'legacy';
}
github jirokun / survey-designer-js / lib / browserUtils.js View on Github external
export function isIELowerEquals(version) {
  // browserが定義されていないときは未知のブラウザ
  if (!browser) return false;
  return browser.name === 'ie' && parseInteger(browser.version.substr(0, browser.version.indexOf('.'))) <= version;
}
github featurist / browser-monkey / test / mountSpec.js View on Github external
function isSupportedBrowser () {
  if (isBrowser) {
    var browser = require('detect-browser')
    if (browser.name === 'ie' && parseInt(browser.version.match(/(\d+)./)[1]) <= 10) {
      return false
    }

    return true
  }
}
github podlove / podlove-ui / src / utils / runtime.js View on Github external
import browser from 'detect-browser'
import MobileDetect from 'mobile-detect'

import { version } from '../../package.json'

const platform = new MobileDetect(window.navigator.userAgent)

const locale = navigator.language || navigator.userLanguage || 'en-us'

const currentLanguage = (() => {
  return head(locale.split('-'))
})()

export default {
  version,
  browser: `${browser.name}:${browser.version}`,
  platform: (platform.tablet() || platform.mobile()) ? 'mobile' : 'desktop',
  language: currentLanguage,
  locale
}
github seejamescode / global-upvote / src / App.js View on Github external
componentDidMount() {
    this.setState({
      browser: browser.name,
      usingExtension: window.self !== window.top,
      version: parseFloat(browser.version)
    });
    this.getStories();
    window.addEventListener("offline", this.toggleConnection);
    window.addEventListener("online", this.toggleConnection);

    if (window.location.hostname !== "localhost") {
      ReactGA.initialize("UA-43808769-9");
      ReactGA.pageview("pageview");
    }
  }
github terkelg / terkel.com-2016 / src / vuex / actions.js View on Github external
export const deviceDetect = function ({ dispatch, state }) {
  function getDeviceType () {
    var useragent = window.navigator.userAgent;
    var mobileDetect = new MobileDetect(useragent);
    if (mobileDetect.tablet()) {
      return 'tablet';
    } else if (mobileDetect.mobile()) {
      return 'mobile';
    } else {
      return 'desktop';
    }
  }

  let device = {
    browser: Browser.name,
    version: Browser.version,
    type: getDeviceType()
  };

  dispatch('DEVICE', device);
};

detect-browser

Unpack a browser type and version from the useragent string

MIT
Latest version published 2 years ago

Package Health Score

74 / 100
Full package analysis