1.0.6 • Published 5 years ago

browsertype.js v1.0.6

Weekly downloads
2
License
MIT
Repository
github
Last release
5 years ago

BrowserType.js

An automated detection library for the current browser.

Installation

Include the script somehow in your page. You can retrieve it using the following methods:

Package manager:

$ npm install browsertype.js --save

$ yarn add browsertype.js

$ bower install browsertype.js --save

CDN:

Usage

Scripts

BrowserType.js registers a plain object in window, containing recognition expressions. It's structure is as following:

BrowserType = {
  isOpera,
  isFirefox,
  isSafari,
  isIE,
  isEdge,
  isChrome,
  isBlink
}

You can use these values directly in conditions:

if(BrowserType.isIE) {
  alert('You got the worst browser around, congratulations.');
} else if(BrowserType.isChrome) {
  alert('You got an evergreen browser, nice!');
}

Stylesheets

BrowserType.js also sets a class on the html element, making it really easy to also differ between browsers in stylesheets.

  • bt-opera
  • bt-firefox
  • bt-safari
  • bt-explorer
  • bt-edge
  • bt-chrome
  • bt-other
1.0.6

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago