-
Notifications
You must be signed in to change notification settings - Fork 80
Home
Detector is a simple, PHP- and JavaScript-based browser- and feature-detection library. Detector gives server-side developers information about what types of devices may be requesting their content as well as the HTML5 & CSS3 features a requesting browser may or may not support. With Detector a developer can serve the appropriate markup, stylesheets, and JavaScript to a requesting browser without being completely dependent on a browser-detection library being up-to-date nor completely dependent on a front-end-only resource loader. 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.
A very simple demo of Detector is available for testing.
The following features are as of v0.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)
- 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
- 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
- browsers & bots that don't support JavaScript can still use your site
- How Detector Works
- Adding Detector to Your Application
- Detector Test Tutorial
- Detector Family Tutorial
- Templating with Detector & Mustache Tutorial
First and foremost thanks to James Pearce 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 (Faruk Ateş, Paul Irish, & Alan Sexton) for giving developers the ability to expand Modernizr via Modernizr.addTest()
.