2017 © Pedro Peláez
 

library detector

Combined browser- & feature-detection for your app

image

mimmi20/detector

Combined browser- & feature-detection for your app

  • Friday, May 6, 2016
  • by mimmi20
  • Repository
  • 1 Watchers
  • 0 Stars
  • 3 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 4 Versions
  • 0 % Grown

The README.md

Detector v0.9.5

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., (*1)

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. PHP implementation of ua-parser is used to collect and record any useful information (like OS or device name) the user-agent string may contain., (*2)

With Detector a developer can serve the appropriate markup, stylesheets, and JavaScript to a requesting browser without being completely dependent on a front-end-only resource loader nor a browser-detection library being up-to-date., (*3)

The server-side portion of Detector is based upon modernizr-server by James Pearce (@jamespearce) and the browser-detection library PHP implementation of ua-parser. Detector utilizes Modernizr for its client-side, feature-detection support., (*4)

Demo of Detector

A very simple demo of Detector is available for testing. It's also now in production on the West Virginia University home page., (*5)

Features

The following features are as of v0.8.5 of Detector:, (*6)

  • stores features detected with Modernizr 2.6.1 (list) and browser & device information detected with PHP implementation of 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
  • browser & bots that don't use JavaScript or cookies can still use your site using a default browser profile
  • provide default families for search engines and browsers that don't support javascript or cookies so your best side is always showing
  • give your mobile users a "desktop" view via family switching (assuming you use a templating system)
  • push feature information to the browser via CSS classes and/or a JavaScript object a la Modernizr
  • use with a templating system like Mustache to create a RESS system
  • confidence checks that help determine if data collected on a per UA basis is correct

Tutorials

More Information

Credits

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., (*7)

The Versions

03/11 2015

0.9.6

0.9.6.0

Combined browser- & feature-detection for your app

  Sources   Download

MIT

The Requires

 

The Development Requires

feature detection detector useragent device user-agent yabfdl ua-parser modernizr-server

03/11 2015

1.0.0

1.0.0.0

Combined browser- & feature-detection for your app

  Sources   Download

MIT

The Requires

 

The Development Requires

feature detection detector useragent device user-agent yabfdl ua-parser modernizr-server

30/08 2015

0.99

0.99.0.0

Combined browser- & feature-detection for your app

  Sources   Download

MIT

The Requires

 

The Development Requires

feature detection detector useragent device user-agent yabfdl ua-parser