-
Notifications
You must be signed in to change notification settings - Fork 77
Detector Test Tutorial
Modernizr-based tests help create the bulk of the data is available in a browser profile. There are broken down into three types:
-
coretests that come from the included version of Modernizr. The profiles created withcoredata are stored inuser-agents/core/and include information fromua-parser-php. -
extendedtests are created by individual developers and are meant to be used on an individual install basis.extendedtests should be seen as a way to expand oncoretests. The information fromextendedtests are store in profiles inuser-agents/extended/.familyinformation is also stored in these same profiles. -
per-requesttests are created by individual developers and are for features that need to be tested on every browser request. They test features that change on a per device basis versus a per request basis. A good example of this is would be device pixel ratio. An iPhone 3G and iPhone 4 can both run the latest version of Mobile Safari but only the iPhone 4 has the Retina display.
Extended tests are tests that, when sending out the full suite of Modernizr tests, get run along-side Core tests but are instead saved to their own user-agent profile. They're meant
to provide developers with a way to add their own Core-like tests but in a way that allows Core to be a standard. To add your own Extended tests
simply follow the Modernizr.addTest() format and put them in tests/extended/. The names of the tests should start with extended- so that their values get put
into the appropriate user-agent file. The string extended- is stripped from the test name when placing it in session.
Per Request tests are tests that get run on every request the browser sends. I'm not sure they'll operate this way in the future. They were designed to
capture features that change on a per device basis versus a per browser basis. To add your own Per Request tests
simply follow the Modernizr.addTest() format and put them in tests/perrequest/. The names of the tests should start with pr- so that their values
are not added to any of the user-agent files. The string pr- is stripped from the test name when placing it in session.