-
Notifications
You must be signed in to change notification settings - Fork 6
Description
So far the results of UserAgentParserComparison have been extremely useful for me, but the overview page of the parsers can be very misleading if you take the numbers at face value. Having a result for a particular user agent string does not mean it is a good result. Perhaps having no result would have been better.
I've been thinking about how to test the quality of the various user agent detection libraries. I'm not talking about nitpicking details like spelling of model names or stuff like that. Even things like 'Opera' vs. 'Opera Mobile' is not that important. I'm talking about clear detection errors.
What I've come up so far is:
- Create a handpicked list of tricky user agent strings
- For each user agent string determine what we're interested in looking at
- Determine a list of acceptable answers, or known false identifications
- Check if we have an acceptable match, and do not have a false identification
- Determine the percentage of correct results
For example if we have the following string:
Opera/9.80 (X11; Linux zvav; U; zh) Presto/2.8.119 Version/11.10
The test would pass if:
- browserName == 'Opera Mini'
- osName != 'Linux'
An identification of Opera on Linux would be the obvious mistake.
Another example:
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Atom/1.0.19 Chrome/43.0.2357.65 Electron/0.30.7 Safari/537.36
The test would pass if:
- browserName != 'Chrome'
This is actually the Atom editor and not the Chrome browser.
And finally:
Mozilla/5.0 (Linux; Android 5.0; SAMSUNG SM-N9006 Build/LRX21V) AppleWebKit/537.36 (KHTML, like Gecko) SamsungBrowser/2.1 Chrome/34.0.1847.76 Mobile Safari/537.36
The test would pass if:
- browserName == 'Samsung Browser' OR browserName == 'SamsungBrowser'
I do realise that sometimes results are open to interpretation, but I think that despite that, it might be a useful way to identify common problems in libraries and help them raise the quality of their identifications.
Is this something you want to work on with me?