Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

The user-agent has two implied pieces of functionality:

1) Describe the device that the agent is coming from (operating system)

2) Describe the capabilities of the agent (this browser, those plugins)

One of the things I loathe about the user agent header is the lack of reasonable maximum length, and the inconsistent way in which developers have overloaded the value. Parsing it is difficult (especially given that the length means there is a lot of scope for bad input).

I would love to see user agent be a virtual header comprised of other headers.

The other headers would not be mandatory, but as most browsers would provide them you could reasonably use them in most cases.

These other headers may be things like:

  os: Windows
  os-version: 7
  client: Gecko
  client-version: 16
  plugins: [{'flash':11}]
Basically... same info but more structure with known acceptable types for certain values.

Headers taking uncompressed space it would also be helpful if shorthand names were accepted: c-v for client-version, etc.

This is me thinking aloud, and perhaps it's an idea that has been thought of before and rejected... but by offering User-Agent as a virtual header that is comprised of all of the other headers you maintain some background compatibility whilst providing something easier to parse, use and trust for developers.



The problem with "fixing" the user-agent string is that making it easier to pass/use only means web-developers will find it easier to continue to abuse it.

In an ideal world web-developers should be testing if individual pieces of functionality exist rather than inferring what is supported based on the browser.

I think JS does a fairly good job of allowing developers to test for functionality, unfortunately CSS does not. I am well aware that it is meant to "fail gracefully" but to a lot of developers they want to supply alternative looks where functionality isn't available and CSS doesn't lend itself to that.

So you wind up inferring CSS support from JS support which is just as broken as inferring JS support from the browser's version/name/platform.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: