A PHP script who analyse the user agent and define the browser name, the browser version and the plateform.
To save execution time (the script takes less than 1ms) ! It's faster to make a regex on a string than use a "database" like the browscap.ini file.
You can try the script in the demo page. If you find a user agent who is not correctly detected please open an issue.
This script will only give you few information about the browser. If you need to know more like browser capabilities, you should check for another project like the Browscap project for example.
I found a pice of code here and here. I don't know who wrote-it first.
- Detect the device type (Desktop|Tablet|Mobile)
- Demo page to try with different user agent
- ini file to define if a browser is supported or not by your application
- Version of the plateform (ex : XP / w7 / W8 / ...)