mirror of
https://github.com/lancedikson/bowser
synced 2024-10-27 20:34:22 +00:00
update readme with better info
This commit is contained in:
parent
fb2608077e
commit
8ebfe6cd48
59
README.md
59
README.md
@ -1,5 +1,4 @@
|
|||||||
Bowser
|
## Bowser
|
||||||
------
|
|
||||||
A Browser detector. Because sometimes, there is no other way, and not even good modern browsers always provide good feature detection mechanisms.
|
A Browser detector. Because sometimes, there is no other way, and not even good modern browsers always provide good feature detection mechanisms.
|
||||||
|
|
||||||
[![bowser ci](https://secure.travis-ci.org/ded/bowser.png)](https://travis-ci.org/ded/bowser/)
|
[![bowser ci](https://secure.travis-ci.org/ded/bowser.png)](https://travis-ci.org/ded/bowser/)
|
||||||
@ -12,8 +11,7 @@ if (bowser.msie && bowser.version <= 6) {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
Flags set for detected Browsers[Engines]
|
## Flags set for detected Browsers[Engines]
|
||||||
-----
|
|
||||||
|
|
||||||
* `chrome`[`webkit`]
|
* `chrome`[`webkit`]
|
||||||
* `firefox`[`gecko`]
|
* `firefox`[`gecko`]
|
||||||
@ -33,8 +31,7 @@ Flags set for detected Browsers[Engines]
|
|||||||
|
|
||||||
For all detected browsers the browser version is set in the `version` field.
|
For all detected browsers the browser version is set in the `version` field.
|
||||||
|
|
||||||
Flags set for detected mobile Operating Systems
|
## Flags set for detected mobile Operating Systems
|
||||||
-----
|
|
||||||
|
|
||||||
* `android`
|
* `android`
|
||||||
* Windows Phone as `windowsphone`
|
* Windows Phone as `windowsphone`
|
||||||
@ -50,8 +47,7 @@ Android, iOS, Windows Phone, WebOS, Bada, and Tizen will all report the OS versi
|
|||||||
|
|
||||||
All detected mobile OSes are additionally flagged `mobile`, **if they are not powering a tablet device**. If a tablet device is detected, the flag `tablet` is set instead.
|
All detected mobile OSes are additionally flagged `mobile`, **if they are not powering a tablet device**. If a tablet device is detected, the flag `tablet` is set instead.
|
||||||
|
|
||||||
Notes
|
### Notes
|
||||||
----
|
|
||||||
Safari, Chrome and some other minor browsers will report that they have `webkit` engines, Firefox and Seamonkey will report that they have `gecko` engines.
|
Safari, Chrome and some other minor browsers will report that they have `webkit` engines, Firefox and Seamonkey will report that they have `gecko` engines.
|
||||||
|
|
||||||
``` js
|
``` js
|
||||||
@ -60,26 +56,23 @@ if (bowser.webkit) {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
Ender installation
|
### Ender Support
|
||||||
-----
|
|
||||||
If you don't already have [Ender](http://ender.no.de) (an npm package) install it now (and don't look back)
|
|
||||||
|
|
||||||
$ npm install ender
|
`package.json`
|
||||||
|
|
||||||
then add bowser to your module collection
|
``` json
|
||||||
|
"dependencies": {
|
||||||
$ ender add bowser
|
"bowser": "x.x.x"
|
||||||
|
|
||||||
use it like this:
|
|
||||||
|
|
||||||
``` js
|
|
||||||
if ($.browser.chrome) {
|
|
||||||
alert('Hello Silicon Valley');
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
Graded Browser Support
|
``` js
|
||||||
---------
|
if (require('bowser').chrome) {
|
||||||
|
alert('Hello Silicon Valley')
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Graded Browser Support
|
||||||
One useful feature of Bowser is that aside from checking one browser from another -- it will keep up to date with [Yahoo's Graded Browser Support](http://developer.yahoo.com/yui/articles/gbs/) chart, giving you access to each grade on the bowser object
|
One useful feature of Bowser is that aside from checking one browser from another -- it will keep up to date with [Yahoo's Graded Browser Support](http://developer.yahoo.com/yui/articles/gbs/) chart, giving you access to each grade on the bowser object
|
||||||
|
|
||||||
``` js
|
``` js
|
||||||
@ -94,20 +87,18 @@ else {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
Building
|
### Contributing
|
||||||
--------
|
If you'd like to contribute a change to bowser, modify the files in `src/`, then run the following (you'll need node + npm installed):
|
||||||
|
|
||||||
If you'd like to contribute a change to bowser, modify the files in src/, then run the following (you'll need node + npm installed):
|
``` sh
|
||||||
|
$ npm install
|
||||||
|
$ make test
|
||||||
|
```
|
||||||
|
|
||||||
$ npm install
|
Please do not check-in the built files `bowser.js` and `bowser.min.js` in pull requests.
|
||||||
$ make
|
|
||||||
|
|
||||||
|
### Adding tests
|
||||||
Testing
|
See the list in `src/useragents.js` with example user agents and their expected bowser object.
|
||||||
-------
|
|
||||||
We started a list `src/useragents.js` with example user agents and their expected bowser object.
|
|
||||||
|
|
||||||
Whenever you add support for new browsers or notice a bug / mismatch, please update the list and
|
Whenever you add support for new browsers or notice a bug / mismatch, please update the list and
|
||||||
check if all tests are still passing.
|
check if all tests are still passing.
|
||||||
|
|
||||||
To run the test call `$ make test`
|
|
||||||
|
Loading…
Reference in New Issue
Block a user