Utilities for processing user-agent strings. Can be used to handle http requests in real-time or to analyze log files.
http://www.bitwalker.eu/software/user-agent-utils
For the latest release, go to https://github.com/HaraldWalker/user-agent-utils/tree/master
This library has reached end-of-life!
Version 1.20 is the last official release.
PULL REQUESTS WILL NOT BE PROCESSED.
If you want to improve this library, fork it and release it yourself.
If you used this library for a commercial product, a donation would have been great during the past years.
A lot of user-agents lie about their identity. That makes US sniffing a guessing game. On websites it is a better approach to detect features using a javascript library like Modernizr (http://modernizr.com/).
Instead of using browser switches, build sites and services that are cross-platform/cross-device compatible.
- #142 Fix iPhone detection in case of Opera Mini agent-string
- #154 Prevent bots with bot in UA-String from pretending to be Safari
- Added latest Edge versions
- Added current and future Chrome and Firefox versions
- #152 improved version discovery specifically for Safari
- #146 Fixed IE mobile 11 version detection
http://bitwalker.eu/user-agent-utils-snapshot/javadoc/index.html
Add dependency:
<dependency>
<groupId>eu.bitwalker</groupId>
<artifactId>UserAgentUtils</artifactId>
<version>1.20</version>
</dependency>
Add dependency for snapshot releases:
<dependency>
<groupId>eu.bitwalker</groupId>
<artifactId>UserAgentUtils</artifactId>
<version>1.21-SNAPSHOT</version>
</dependency>
- This project is NOT accepting any new contributions.
- If you want changes, feel free to fork this project and start your own version. Send me a link and I'll be happy to promote it.
- Code has been contributed by: Nathan Maves, Francisco Collao (https://github.com/pcollaog), Madgency (https://github.com/guignol), Pavel Sher (https://github.com/pavelsher), Pierre Etchemaite, Alexander Radzin (https://github.com/alexradzin), SeabassNg (https://github.com/SeabassNg), Sudeep Sinha (https://github.com/sudeep-sinha), John Dydo, frankdev (https://github.com/frankdev), Lew Dawson, Joachim Mueller (https://github.com/joachimmueller), Jason Calabrese (https://github.com/jasoncalabrese), Thorsten Schaefer, Parker Seidel (https://github.com/parker), Joris Aerts (https://github.com/JorisAerts), Stephan Heffner, Filipe Névola (https://github.com/filipenevola), John Patrick (https://github.com/nhojpatrick), Konrad Kubacki (https://github.com/konradkg), Vipul Delwadia (https://github.com/vipuldelwadia) and more. A BIG thank you to all of them!
Jetbrains
Can I add new browsers or operating systems?
Unfortunately not directly. This library uses enums to represent browsers and operating systems to make using it easy and readable. Unfortunately the use of enums also has some disadvantages. You can make a pull request on trunk for a new browser or operating system if all tests are still passing. The purpose of this library is not to detect every possible version, so you’ll have to provide the business value for a change.
Where can I report bugs or make feature requests
Go to https://github.com/HaraldWalker/user-agent-utils/issues
How can I improve the performance of the user-agent parsing?
When handling requests on a web-server, consider if you need both the browser and operating system or if one of the two gives you enough information. As the parsing uses an ordered tree structure, performance depends a lot on the type of clients making the requests. The most common browsers and operating systems will be parsed faster than exotic ones. Consider caching the results temporarily.
Are there other libraries like this?
When I started this project in 2010 there were no other libraries offering the features I was looking for. Currently there are both open source as well as commercial solutions.
http://www.bitwalker.eu/contact
- Added support for Chrome 52,53,54,55,56 and MS Edge 15
- Added iOS 10, iOS 10.0, iOS 10.1, iOS 10.2 for iPhone and iPad
- #138 Improved future Microsoft Edge detection and added Edge 13
- Added current and future Firefox and Chrome versions
- Improved detection of unsuported new Firefox versions
- Added detection of Firefox mobile for iOS devices
- Improved Phantom.js detection as BOT
- Added support for Android 6 and Android 6 tablets
- #118 Updated Opera support
- #115 Improved Ubuntu detection
- #114 Fixed Microsoft Edge version detection
- #125 Improved Opera version detection
- Safari 9 support
- Added Ubuntu and Ubuntu Touch (mobile) detection
- Added Windows 10 mobile detection
- Added Microsoft Edge browser detection (contributed by https://github.com/nmaves)
- Added future Firefox versions up to 42.
- iOS 8.2, 8.3, 8.4 and 9 added
- Chrome updated with latest versions
- Firefox updated with latest versions
- Updated Opera browser detection
- Xbox OS and Internet Explorer for Xbox added
- Improved CFNETWORK browser detection
- Added Vivaldi browser
- Improved Windows 10 detection
- Improved bot detection
- Added Android 5 tablet detection
- Performance improvements
- Safari 7 and 8 added
- iOS 8.1 added
- Wearable device category added with detection of Google Glass
- Chrome OS added
- Windows 10 added
- Android 5 added
- IOS8 support added
- added Opera Coast as new mobile browser
- more Chrome and Firefox versions added, including future releases (up to Firefox 40 and Chrome 40)
- added 3 Opera versions
- performance improvements
- Added additional Chrome and Opera browser versions
- Added current and future Firefox versons
- Added agent string handling for Microsoft RSS platform user-agents
- Added detection of Windows Phone 8.1 and IE Mobile 11.
- Fixed null pointer exception when user-agent-string was null
- Adjusted IE11 regex to match IE11 on Win8
- Fix for version detection of Internet Explorer 11, contributed by https://github.com/parker
- Browser versions are now comparable (#33), contributed by https://github.com/reindyr
- Detect image proxy used by Google for Gmail
- Detect Google's mobile bot (#8)
- Internet Explorer 10 mobile version added (#28)
- Improved Chrome mobile detection (#30)
- Fixed none unique manufacturer id (issue #22)
- added IOS 7 detection and improved IOS detection for iPads (issue #21)
- added Chrome 30 and 31
- Fixed and extended OS and browser detection when using Firefox on mobiles or tablets
- Added additional and future Firefox versions
- Added Chrome 29
- Added Opera 11, 12, 15 & 16
- Fixed version detection of Chrome Mobile
- Added Firefox 20 detection plus beta and future versions
- Added beta and future versions of Chrome
- Option just to check just for a given collection of browsers or operating systems
- Updated Chrome, Firefox and Safari detection to include the latest versions
- Minor code optimizations
- The package name has changed. Update import statements if you've been using the library before!