Skip to content

Commit e20c2c2

Browse files
committed
Update README
1 parent 71fce9b commit e20c2c2

File tree

2 files changed

+50
-38
lines changed

2 files changed

+50
-38
lines changed

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright (c) 2010-2015 Niels Leenheer
1+
Copyright (c) 2010-2017 Niels Leenheer
22

33
Permission is hereby granted, free of charge, to any person obtaining
44
a copy of this software and associated documentation files (the

README.md

Lines changed: 49 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,26 @@
11
<img src="https://api.whichbrowser.net/whichbrowser.svg" width="400">
22

3-
This project sets up a server using WhichBrowser that exposes an API for browser detection that can be used by JavaScript in the browser. This project uses the [WhichBrowser/Parser](https://github.com/WhichBrowser/Parser) library for the actual useragent sniffing.
3+
This is an extremely complicated and almost completely useless browser sniffing library. Useless because you shouldn't use browser sniffing. So stop right now and go read something about feature detecting instead. I'm serious. Go away. You'll thank me later.
4+
5+
6+
WhichBrowser/Server
7+
===================
8+
9+
This project sets up a server using WhichBrowser that exposes an API for browser detection that can be used by JavaScript in the browser. This project uses the [WhichBrowser/Parser-PHP](https://github.com/WhichBrowser/Parser-PHP) library for the actual useragent sniffing.
410

511
[![Build Status](https://travis-ci.org/WhichBrowser/Server.svg?branch=master)](https://travis-ci.org/WhichBrowser/Server)
612
[![License](https://poser.pugx.org/whichbrowser/server/license)](https://packagist.org/packages/whichbrowser/server)
713
[![Latest Stable Version](https://poser.pugx.org/whichbrowser/server/v/stable)](https://packagist.org/packages/whichbrowser/server)
814

915
[![Twitter Follow](https://img.shields.io/twitter/follow/whichbrowserlib.svg?style=social)](https://twitter.com/whichbrowserlib)
1016

11-
If you are looking for the PHP API for WhichBrowser, please go to the [WhichBrowser/Parser](https://github.com/WhichBrowser/Parser) project.
17+
Also available:
18+
19+
- [WhichBrowser/Parser-PHP](https://github.com/WhichBrowser/Parser-PHP)<br>
20+
A PHP version of WhichBrowser for use on the server
21+
22+
- [WhichBrowser/Parser-JavaScript](https://github.com/WhichBrowser/Parser-JavaScript)<br>
23+
A JavaScript version of WhichBrowser for use with Node.js on the server
1224

1325
---
1426

@@ -87,10 +99,10 @@ Another possiblity is to query the object:
8799
result.isType('desktop')
88100
// true
89101

90-
result.isType('mobile', 'tablet', 'media')
102+
result.isType('mobile', 'tablet', 'media')
91103
// false
92104

93-
result.isBrowser('Maxthon', '<', '4.0.5')
105+
result.isBrowser('Maxthon', '<', '4.0.5')
94106
// false
95107

96108
result.isOs('iOS', '>=', '5')
@@ -103,7 +115,7 @@ Another possiblity is to query the object:
103115
You can also access these properties directly:
104116

105117
result.browser
106-
// Chrome 27
118+
// Chrome 27
107119

108120
result.engine
109121
// Blink
@@ -151,27 +163,27 @@ After a new `WhichBrowser` object is created, it contains a number of properties
151163

152164
**Properties:**
153165

154-
* `browser`
166+
* `browser`
155167
an object that contains information about the browser itself
156-
* `engine`
168+
* `engine`
157169
an object that contains information about the rendering engine
158-
* `os`
170+
* `os`
159171
an object that contains information about the operating system
160-
* `device`
172+
* `device`
161173
an object that contains information about the device
162174

163175
**Functions:**
164176

165-
`isType(type [,type [,type [,type]]])`
177+
`isType(type [,type [,type [,type]]])`
166178
If a single argument is used, the function returns `true` if the argument matches the `type` propery of `device` obejct. It can use multiple arguments in which case the function returns `true` if one of the arguments matches. If none of the arguments matches, it returns `false`
167179

168-
`isBrowser(name [, comparison, version])`
180+
`isBrowser(name [, comparison, version])`
169181
Is used to query the `name` and `version` property of the `browser` object. The funcion can contain a single argument to a simple comparison based on `name`, or three arguments to compare both `name` and `version`. The first argument always contains the name of the browser. The second arguments is a string that can container either `<`, `<=`, `=`, `=>` or `>`. The third is an integer, float or string that contains the version. You can use versions like `10`, `10.7` or `'10.7.4'`. For more information about how version comparisons are performed, please see the `is()` function of the `Version` object.
170182

171-
`isEngine(name [, comparison, version])`
183+
`isEngine(name [, comparison, version])`
172184
Is used to query the `name` and `version` property of the `engine` object. This function works in exactly the same way as `isBrowser`.
173185

174-
`isOs(name [, comparison, version])`
186+
`isOs(name [, comparison, version])`
175187
Is used to query the `name` and `version` property of the `os` object. This function works in exactly the same way as `isBrowser`.
176188

177189

@@ -181,17 +193,17 @@ The `Browser` object is used for the `browser` property of the main `WhichBrowse
181193

182194
**Properties:**
183195

184-
* `name`
196+
* `name`
185197
a string containing the name of the browser
186-
* `version`
198+
* `version`
187199
a version object containing information about the version of the browser
188-
* `stock`
200+
* `stock`
189201
a boolean, true if the browser is the default browser of the operating system, false otherwise
190-
* `channel`
202+
* `channel`
191203
a string containing the distribution channel, ie. 'Nightly' or 'Next'.
192-
* `mode`
204+
* `mode`
193205
a string that can contain the operating mode of the browser, ie. 'proxy'.
194-
* `hidden`
206+
* `hidden`
195207
a boolean that is true if the browser does not have a name and is the default of the operating system.
196208

197209

@@ -201,9 +213,9 @@ The `Engine` object is used for the `engine` property of the main `WhichBrowser`
201213

202214
**Properties:**
203215

204-
* `name`
216+
* `name`
205217
a string containing the name of the rendering engine
206-
* `version`
218+
* `version`
207219
a version object containing information about the version of the rendering engine
208220

209221

@@ -213,9 +225,9 @@ The `Os` object is used for the `os` property of the main `WhichBrowser` object
213225

214226
**Properties:**
215227

216-
* `name`
228+
* `name`
217229
a string containing the name of the operating system
218-
* `version`
230+
* `version`
219231
a version object containing information about the version of the operating system
220232

221233

@@ -225,13 +237,13 @@ The `Device` object is used for the `device` property of the main `WhichBrowser`
225237

226238
**Properties:**
227239

228-
* `type`
240+
* `type`
229241
a string containing the type of the browser.
230-
* `identified`
242+
* `identified`
231243
a boolean that is true if the device has been positively identified.
232-
* `manufacturer`
244+
* `manufacturer`
233245
a string containing the manufacturer of the device, ie. 'Apple' or 'Samsung'.
234-
* `model`
246+
* `model`
235247
as string containing the model of the device, ie. 'iPhone' or 'Galaxy S4'.
236248

237249
The `type` property can contain any value from the following list:
@@ -260,31 +272,31 @@ The `Version` object is used for the `version` property of the `browser`, `engin
260272

261273
**Properties:**
262274

263-
* `original`
275+
* `original`
264276
a string containing the original version number.
265-
* `alias`
277+
* `alias`
266278
a string containing an alias for the version number, ie. 'XP' for Windows '5.1'.
267-
* `details`
279+
* `details`
268280
an integer containing the number of digits of the version number that should be printed.
269-
* `major`
281+
* `major`
270282
an integer containing the major version number.
271-
* `minor`
283+
* `minor`
272284
an integer containing the minor version number.
273-
* `type`
285+
* `type`
274286
a string containing a type indicator, ie. 'beta' or 'alpha'.
275287

276288
**Functions:**
277289

278-
`is(version)` or `is(comparison, version)`
290+
`is(version)` or `is(comparison, version)`
279291
Using this function it is easy to compare a version to another version. If you specify only one argument, this function will return if the versions are the same. You can also specify two arguments, in that case the first argument contains the comparison operator, such as `<`, `<=`, `=`, `=>` or `>`. The second argument is the version you want to compare it to. You can use versions like `10`, `10.7` or `'10.7.4'`, but be aware that `10` is not the same as `10.0`. For example if our OS version is `10.7.4`:
280292

281-
result.os.version.is('10.7.4')
293+
result.os.version.is('10.7.4')
282294
// true
283295

284-
result.os.version.is('10.7')
296+
result.os.version.is('10.7')
285297
// true
286298

287-
result.os.version.is('10')
299+
result.os.version.is('10')
288300
// true
289301

290302
result.os.version.is('10.0')

0 commit comments

Comments
 (0)