Browscap provides an improved version of PHP's get_browser() function.

The get_browser() function can be used to tell what a visitor's browser is capable of. Unfortunately, the version provided by PHP has a number of limitations, namely:

  • It can be difficult or impossible to configure for shared hosting environments.
  • The data used to identify browsers and determine their capabilities requires consistent maintenance to keep up-to-date.

Browscap automates maintenance by storing browser data in a database and automatically retrieving the latest data on a configurable schedule.

Browscap also provides statistics on visiting browsers.

Requirements

Browscap requires that your server be able to "phone out" (make a http request) to retrieve and update its user agent database.

Note: Some hosting companies have this capability blocked.

Installation

Browscap can be installed via the standard Drupal installation process.

API

Modules can make use of browscap data by calling browscap_get_browser() anywhere they would otherwise call the PHP get_browser() function.

Note: browser_name_regex is not returned.

Related Modules

A number of modules and themes integrate with Browscap, including:

Modules

Theme switching

  • Mobile Tools uses Browscap to get data about whether a visitor is on a mobile device.
  • Switchtheme uses Browscap to switch the site theme based on the user agent of a visitor.
  • Mobile Switch provides a simple automatic theme switch functionality for mobile devices, detected by browscap.

Page layout configuration

  • Browscap Block allows blocks to be shown or hidden depending on if the site visitor is using a desktop or mobile browser.
  • Browscap CTools allows panel panes to be shown or hidden depending on if the site visitor is using a desktop or mobile browser.

Themes

  • AdaptiveTheme integrates with Browscap to allow regions to be unset or blocks to change regions when the theme is viewed on a mobile device.

Sponsors

Development of Browscap is sponsored by Acquia and the Ontario Ministry of Northern Development and Mines.

A special thanks goes out to Gary Keith who provides regular updates to the browscap user agent database, and specifically for adding a non-zipped CSV version of browscap to support this module.

Downloads

Recommended releases

Version Downloads Date Links
7.x-2.0 tar.gz (11.33 KB) | zip (13.12 KB) 2012-Nov-22 Notes
6.x-2.0 tar.gz (11.62 KB) | zip (13.38 KB) 2012-Nov-22 Notes

Development releases

Project Information


Maintainers for Browscap

  • Devin Carlson - 79 commits
    last: 21 weeks ago, first: 1 year ago
  • Rob Loach - 12 commits
    last: 1 year ago, first: 4 years ago
  • greggles - 19 commits
    last: 2 years ago, first: 3 years ago
  • mikeryan - 6 commits
    last: 4 years ago, first: 7 years ago

Issues for Browscap

To avoid duplicates, please search before submitting a new issue.
All issues
Bug reports
Statistics (2 years)
New issues
Open bugs
Participants