User-Agent URI

Why?

There is incredible mess in User-Agent headers transferred in almost every HTTP request over the Network.

Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1700.102 Safari/537.36
Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.3; Trident/7.0)
Mozilla/5.0 (Windows NT 6.3; Trident /7.0; rv:11.0) like Gecko
Mozilla/5.0 (iPhone; CPU iPhone OS 6_0 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Version/6.0 Mobile/10A5376e Safari/8536.25 (compatible; Googlebot-Mobile/2.1; +http://www.google.com/bot.html)

Please stop this madness!

Do not use User-Agent at all

The Web should be based on open standards. The sites should be wrtitten according to a specification – not for a particular browser. The server do not have to know, what client software is used, in order to send you properly formatted page. You can configure your web browser to not send User-Agent HTTP header at all – it is not mandatory.

Or if you do, encode it as URI

But sometimes it might be nice to have statistical data – e.g.:

  • class of device – do our visitors use desktops, tablets or mobile phones?
  • screen/window resolution – is layout of our pages good for most of our visitors?
  • browser and its engine name/version and operating system – which ones are the most popular?

Or sometimes it makes sense to redirect users of mobile devices from www.example.com to m.example.com.

There are also users who prefer privacy, so they will not tell you the name/version of their browser and other top secret information, but have no problem with advertising the device class (desktop/tablet/mobile) or screen resolution. URI makes possible to selectively send only parts that user want to share with servers.

On the server side, you can reliably decode components of the User-Agent URI and obtain structured data.

User-Agent URI, open standard and free software © 2014-2022 GlobalCode