UserAgent => OS, browser etc lazarus / 38-Networking and Web Programming ---------------------------------------------------------------------- Renat.Su · 2019-01-18 11:49 Can anyone share the function for parsing the useragent (HTTP header) on the OS and browser (for example)? ---------------------------------------------------------------------- lucamar · 2019-01-18 13:00 IIRC UserAgent is a free-form string without a strictly defined format. There are certain conventions like "program/9.89 (extensions)" which you may be able to parse but it's not guaranteed that it will work always and for each string. That said, you could take the most common UserAgents, try to find their commonalities and build a simple parser. It shouldn't be too difficult. Or you could try to translate any of the gazillions JS/PHP/Python implementations out there, just a google search away ---------------------------------------------------------------------- Renat.Su · 2019-01-18 16:04 Quote from: lucamar on January 18, 2019, 02:00:13 pmIIRC UserAgent is a free-form string without a strictly defined format. There are certain conventions like "program/9.89 (extensions)" which you may be able to parse but it's not guaranteed that it will work always and for each string. That said, you could take the most common UserAgents, try to find their commonalities and build a simple parser. It shouldn't be too difficult. Or you could try to translate any of the gazillions JS/PHP/Python implementations out there, just a google search away Yes, I know it's not standardized and I can parse this string myself. I agree with You. But if there is a ready-made solution, why not take advantage of this solution? ---------------------------------------------------------------------- lucamar · 2019-01-18 16:47 I don't know of any but maybe one of the networking libraries or web development frameworks has something similar. Look in the Web Deveopment Portal to get links to them. ---------------------------------------------------------------------- Remy Lebeau · 2019-01-19 01:30 Quote from: lucamar on January 18, 2019, 02:00:13 pmIIRC UserAgent is a free-form string without a strictly defined format. There are certain conventions like "program/9.89 (extensions)" which you may be able to parse but it's not guaranteed that it will work always and for each string. Web browsers, for instance, don't commonly follow that "simple" convention, they have a much more elaborate format: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/User-Agent QuoteSyntax Code: [Select]User-Agent: / Common format for web browsers: User-Agent: Mozilla/ () () Directives     A product identifier     A version number of the product.     Zero or more comments containing sub product information, for example. User-Agent is formally defined in RFC 2616 Section 14.43 and RFC 7231 Section 5.5.3. ---------------------------------------------------------------------- Renat.Su · 2019-01-19 10:12 Thank You! Very useful information