Detector dynamically creates profiles using a browser's (mainly) unique user-agent string as a key. Using Modernizr it records the HTML5 & CSS3 features a requesting browser may or may not support. ua-parser-php is used to collect and record any useful information (like OS or device name) the user-agent string may contain.
The server-side portion of Detector is based upon modernizr-server by James Pearce (@jamespearce) and the browser-detection library ua-parser-php. Detector utilizes Modernizr for its client-side, feature-detection support.
Demo of Detector
The following features are as of v0.8.5 of Detector:
- stores features detected with Modernizr 2.5.2 (list) and browser & device information detected with ua-parser-php (based on ua-parser) on the server as part of a browser profile for easy retrieval
- uses the user agent string as a unique key for looking up information (e.g. one profile per user agent)
- majority of tests are run only once per unique user agent string so only one user is ever tested & redirected
- add your own feature tests and store the results using Modernizr's addTest() API
- tests can be created that run once per user agent, once per session, or on every request
- version your browser profiles so you can force them to be recreated after adding new tests
- easily organize browsers into families based on a mix of supported features & device information
- give your mobile users a "desktop" view via family switching (assuming you use a templating system)
- use with a templating system like Mustache to create a RESS system
- Adding & Using Detector With Your Application
- Creating Browser Groupings
- Creating Feature Tests for Detector
- Pushing Detector Data to the Browser
- Templating with Detector & Mustache
- How Detector Works
- RESS, Server-Side Feature-Detection and the Evolution of Responsive Web Design
- Why I Created Detector
First and foremost, thanks to James Pearce (@jamespearce) for putting together modernizr-server and giving me a great base to work from. I also took some of the copy from his README and used it in the section, "Adding Detector to Your Application." Also, thanks to the guys behind Modernizr for giving developers a great lib as well as the the ability to expand Modernizr via
Modernizr.addTest(). Finally, thanks to Bryan Rieger (@bryanrieger) & Stephanie Rieger (@stephanierieger) of Yiibu and Luke Wroblewski (@lukew) for providing inspiration via Profile and RESS respectively.