2

Looking for a Java library that converts User-Agent header into browser name and version.

I need this information in order to understand whether I can send XML+XSL to the browser, or I should do the transformation to XHTML on the server.

before
  • 585
  • 6
  • 12
yegor256
  • 102,010
  • 123
  • 446
  • 597
  • 1
    Take a look at http://stackoverflow.com/questions/1493617/looking-for-a-java-user-agent-string-parser – Murali VP Jul 16 '11 at 04:33
  • 2
    Any library you use would have to be updated multiple times a month to work. Consider that Chrome and Firefox change versions every few months at most now. Look into parsing http://browsers.garykeith.com/downloads.asp on your own -- it's a regularly updated database of expressions for matching user agents. – Dan Grossman Jul 16 '11 at 04:37
  • I need this information in order to understand whether I can send XML+XSL to the browser, or I should do the transformation to XHTML on the server – yegor256 Jul 16 '11 at 05:00
  • I already answered please refer this link [Browser and OS details][1] [1]: http://stackoverflow.com/questions/1326928/how-can-i-get-client-infomation-such-as-os-and-browser/18030465#18030465 – lambodar Sep 16 '14 at 09:33

1 Answers1

1

I need this information in order to understand whether I can send XML+XSL to the browser, or I should do the transformation to XHTML on the server.

It seems the best approach for that is content negotiation. When you run a restaurant (server), don't ask the diner (UA) what their name is, just ask them what they want to eat (content type)!

Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433
  • What content type I should expect when the browser is supporting XSLT 2.0? – yegor256 Jul 16 '11 at 06:09
  • @yegor256: *"What content type I should expect when the browser is supporting XSLT 2.0? "* I don't understand. Are you asking *'what is the content-type of XSLT?'*? @trashgod: Thanks! – Andrew Thompson Jul 16 '11 at 14:15