Skip to content
This repository has been archived by the owner on Oct 17, 2021. It is now read-only.

How Detector Works

ginader edited this page Jun 16, 2012 · 3 revisions

Detector's implementation is fairly simple. Detector is based upon the notion that a browser's user agent string can (sort of) be seen as a fingerprint. Essentially, if you've had one visit from a browser with a particular user agent string and recorded its features then there is a good chance that future visits from browsers with that user agent string will share the same features. With that introduction here is how it works:

  1. Detector checks to see if the user requesting information has visited the site before by checking for an open session. If there is an open session Detector relies on that session for the list of features for that browser.
  2. If a session is not already open Detector compares the user agent string with a list of user agent strings that have already visited the site. If it matches one of those user agent strings Detector users that user agent's list of features for the ones that the new visitor should have.
  3. If Detector doesn't find a match in the list of existing user agent strings it will: send a full suite of Modernizr tests to the new browser, record the results of those tests in a cookie, reload the page, and save those results to the server. Those results are then available to the developer.

Checking of the version number of core and extended profiles is done in Step #2. If their is a version mis-match step #3 is run.