Advanced user agent recognition

 

Advanced user agent recognition is a very powerful feature which lets you set definitions very precisely. For example, you could have one browser definition which matched a particular browser for versions 7.01, yet another that would pick up versions 7.02 through 7.09 – all without having to hard code the version number.

 

For example, this is accomplished by creating a user agent identification string like so:

 

 Browser A: "Mozilla/7.01*

 Browser B: "Mozilla/7.0[2-9]*"

 

Note: Any bracket characters used in your user agent identification strings are assumed to refer to this advanced pattern matching expression, whereby the values in the brackets represent a valid range or valid single characters of data. For example, "Mozilla/[67]*" would match for Mozilla/6 and Mozilla/7. If you wish to use actual brackets in your user agent strings, add a "\" character before each bracket. For example, "Mozilla/7.01 \[en\]*" would pick up the user agent string of "Mozilla/7.01 [en] (WinNT; I)". Again, like most other techniques, this technique can be seen by viewing some of the browser definitions in your maindefs.bdf .

 

See Also:

How the visiting browser is identified

Understanding browsers

Working with browsers