| 1 |
The browscap module provides a replacement for PHP's get_browser() function.
|
| 2 |
get_browser() is difficult (or impossible) to configure for most
|
| 3 |
users in shared webhosting situations, and requires attention to keep the
|
| 4 |
underlying data (browscap.ini) up-to-date. This module avoids the
|
| 5 |
configuration issue by storing the data in a database table, and the
|
| 6 |
freshness issue by automatically retrieving the latest data on a
|
| 7 |
weekly basis from http://www.garykeith.com/ (if cron.php is run regularly).
|
| 8 |
|
| 9 |
Also, statistics on browsers visiting the site may be captured by
|
| 10 |
enabling monitoring in the browscap settings.
|
| 11 |
|
| 12 |
Installation
|
| 13 |
|
| 14 |
1. Place the browscap folder in the modules directory of your
|
| 15 |
Drupal installation.
|
| 16 |
|
| 17 |
2. Import the browscap.mysql file into your MySQL database (or the
|
| 18 |
browscap.pgsql file into your PostgresSQL databse).
|
| 19 |
|
| 20 |
3. Enable the browscap module in the administration tools.
|
| 21 |
|
| 22 |
4. Go to http://www.example.com/cron.php to perform the initial import
|
| 23 |
of the browscap data.
|
| 24 |
|
| 25 |
API
|
| 26 |
|
| 27 |
Modules wishing to make use of browscap data may call
|
| 28 |
browscap_get_browser() anywhere they would otherwise call get_browser()
|
| 29 |
(see http://us3.php.net/manual/en/function.get-browser.php). Note that
|
| 30 |
browser_name_regex is not returned - otherwise, the results should be
|
| 31 |
identical to calling get_browser().
|
| 32 |
|
| 33 |
Credits
|
| 34 |
|
| 35 |
Mike Ryan (drupal@virtuoso-performance.com) is the author and maintainer
|
| 36 |
of this module.
|
| 37 |
|
| 38 |
Thanks to Gary Keith (http://www.garykeith.com/) for providing
|
| 39 |
regular updates to the browscap data, and specifically for adding
|
| 40 |
a non-zipped CSV version of browscap to support this module.
|