mirror of
https://github.com/lancedikson/bowser
synced 2024-10-27 20:34:22 +00:00
commit
76037d9d8f
25
README.md
25
README.md
@ -28,18 +28,31 @@ Use it to get object with detected flags of your current browser.
|
|||||||
### bowser._detect(ua `:String`)`:Object`
|
### bowser._detect(ua `:String`)`:Object`
|
||||||
Use it to get object with detected flags from User Agent string.
|
Use it to get object with detected flags from User Agent string.
|
||||||
|
|
||||||
### bowser.check(minVersions`:Object`, strictMode`:Boolean`, [ua]`:String`)`:Boolean`
|
### bowser.check(minVersions`:Object`, [strictMode]`:Boolean`, [ua]`:String`)`:Boolean`
|
||||||
Use it to check if browser supported.
|
Use it to check if browser supported.
|
||||||
|
|
||||||
```
|
``` js
|
||||||
browser.check({msie: "11"}, window.navigator.userAgent);
|
/**
|
||||||
// true / false
|
* in case of using IE10
|
||||||
|
*/
|
||||||
|
browser.check({msie: "11"}); // true
|
||||||
|
browser.check({msie: "9.0"}); // false
|
||||||
|
|
||||||
|
/**
|
||||||
|
* specific user agent
|
||||||
|
*/
|
||||||
|
browser.check({chrome: 45}, window.navigator.userAgent); // true
|
||||||
|
|
||||||
|
/**
|
||||||
|
* but false in strict mode
|
||||||
|
*/
|
||||||
|
browser.check({chrome: 45}, true, window.navigator.userAgent); // false
|
||||||
```
|
```
|
||||||
|
|
||||||
### bowser.compareVersions(versions`:Array<String>`)`:Number`
|
### bowser.compareVersions(versions`:Array<String>`)`:Number`
|
||||||
Use it to compare two versions.
|
Use it to compare two versions.
|
||||||
|
|
||||||
```
|
``` js
|
||||||
browser.compareVersions(['9.0', '10']);
|
browser.compareVersions(['9.0', '10']);
|
||||||
// -1
|
// -1
|
||||||
```
|
```
|
||||||
@ -47,7 +60,7 @@ browser.compareVersions(['9.0', '10']);
|
|||||||
### bowser.isUnsupportedBrowser(minVersions`:Object`, [strictMode]`:Boolean`, [ua]`:string`)`:Boolean`
|
### bowser.isUnsupportedBrowser(minVersions`:Object`, [strictMode]`:Boolean`, [ua]`:string`)`:Boolean`
|
||||||
Use it to check if browser is unsupported.
|
Use it to check if browser is unsupported.
|
||||||
|
|
||||||
```
|
``` js
|
||||||
browser.isUnsupportedBrowser({msie: "10"}, window.navigator.userAgent);
|
browser.isUnsupportedBrowser({msie: "10"}, window.navigator.userAgent);
|
||||||
// true / false
|
// true / false
|
||||||
```
|
```
|
||||||
|
Loading…
Reference in New Issue
Block a user