A WordPress Plugin wrapper for Dave Olsen's Detector: a simple, PHP- and JavaScript-based browser- and feature-detection library.
| Author: | Steve Barnett (profile at wordpress.org) |
| WordPress version required: | 3.0 |
| WordPress version tested: | 3.0.5 |
| Plugin version: | 0.9.5 |
| Added to WordPress repository: | 21-07-2012 |
| Last updated: | 10-09-2012
Warning! This plugin has not been updated in over 2 years. It may no longer be maintained or supported and may have compatibility issues when used with more recent versions of WordPress.
|
| Rating, %: | 0 |
| Rated by: | 0 |
| Plugin URI: | |
| Total downloads: | 2 034 |
| Active installs: | 10+ |

Click to start download
|
Detector is a simple, PHP- and JavaScript-based browser- and feature-detection library that can adapt to new devices & browsers on its own without the need to pull from a central database of browser information.
Also available on GitHub: https://github.com/SteveBarnett/Detector.
Full documentation is available at github / dmolsen / Detector.
FAQ
How do I use Detector?
In order to access the features you need to use the $ua object that is automatically created with the inclusion of Detector in your application. Use the $ua object in a similar way that you would have used the Modernizr object on the client-side:
global $ua;
// your script
if ($ua->svg) {
...
} elseif ($ua->canvas) {
...
}
See the full list of browser features that are tested by Modernizr and available with Detector. All of the features tested with ua-parser-php are also available from the $ua variable (e.g. $ua->isMobile or $ua->browserFull)
Some features, (in particular video, audio, input, and inputtypes) have sub-features, so these are available as nested PHP objects:
if ($ua->inputtypes->search) {
print "<input type='search' ...";
} else {
print "<input type='text' ...";
}
All features are returned as integer 1 or 0 for true or false, so they can be used in logical evaluations in PHP. Sub-features can return 1, 0, or a real value (e.g. screen width).
ChangeLog
0.9.5
Updated to match dmoslen’s current Detector
0.8.5
Updated to match dmoslen’s current Detector
0.8.2
Updated to match dmoslen’s current Detector
0.8.1