WordPress.org

Ready to get started?Download WordPress

Plugin Directory

Quick Browscap

Quick Browscap allows you to quickly get detailed browser capabilities from user agent string.

1. How can I get detailed browser capabilities from user agent string from my own PHP code?

Here's typical example:

global $quick_browscap;
if(isset($quick_browscap) && is_object($quick_browscap)){
    $agent = 'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_2; en-us) AppleWebKit/525.18 (KHTML, like Gecko) Version/3.1.1 Safari/525.18';

    /*
    * First argument is user agent (string, optional, default is $_SERVER['HTTP_USER_AGENT']).
    * Second argument is return array or not (bool, optional, default is false to return object).
    * Example to return capabilities for given agent string $agent as PHP array.
    */
    $bw_info = $quick_browscap->get_browser($agent, true);

    /* Output $bw_info array */
    echo '<pre>'.print_r($bw_info, true).echo '</pre>';
}

This is output of the preceeding code:

Array
(
    [browser_name] => Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_2; en-us) AppleWebKit/525.18 (KHTML, like Gecko) Version/3.1.1 Safari/525.18
    [browser_name_regex] => ^mozilla/5\.0 \(macintosh; .; .*mac os x.*\) applewebkit/.* \(.*\) version/3\.1.* safari/.*$
    [browser_name_pattern] => Mozilla/5.0 (Macintosh; ?; *Mac OS X*) AppleWebKit/* (*) Version/3.1* Safari/*
    [Parent] => Safari 3.1
    [Platform] => MacOSX
    [Browser] => Safari
    [Version] => 3.1
    [MajorVer] => 3
    [MinorVer] => 1
    [Frames] => 1
    [IFrames] => 1
    [Tables] => 1
    [Cookies] => 1
    [BackgroundSounds] => 1
    [JavaApplets] => 1
    [JavaScript] => 1
    [CSS] => 2
    [CssVersion] => 2
    [supportsCSS] => 1
    [Alpha] =>
    [Beta] =>
    [Win16] =>
    [Win32] =>
    [Win64] =>
    [AuthenticodeUpdate] =>
    [CDF] =>
    [VBScript] =>
    [ActiveXControls] =>
    [Stripper] =>
    [isBanned] =>
    [WAP] =>
    [isMobileDevice] =>
    [isSyndicationReader] =>
    [Crawler] =>
    [AOL] =>
    [aolVersion] => 0
    [netCLR] =>
    [ClrVersion] => 0
)

2. How can end user update browser capabilities database?

If users hosting environment supports fetching remote content user can go to Admin -> Settings -> Quick Browscap and click "Update" button. User will be informed if update was successful or not. Quick Browscap works out the box because it bundles latest browser capabilities database at the time of release.

3. Is it possible for end user to update browser capabilities database automatically?

Yes. Default behavior is to update browser capabilities database automatically every seven days (weekly). Auto update can be toggled using Admin -> Settings -> Quick Browscap -> Enable automatic weekly database update check checkbox.

4. How to debug Quick Browscap browser capabilities database update functionality?

Define WP_DEBUG constant in your wp-config.php or turn on the debug mode from Admin -> Settings -> Quick Browscap -> Debug mode.

Requires: 3.0 or higher
Compatible up to: 3.4.2
Last Updated: 2012-8-29
Downloads: 1,431

Ratings

5 stars
5 out of 5 stars

Support

Got something to say? Need help?

Compatibility

+
=
Not enough data

0 people say it works.
0 people say it's broken.

100,1,1 100,1,1 100,1,1 100,1,1
100,2,2
100,1,1
100,1,1