User agent: Difference between revisions

From MozillaWiki
Jump to navigation Jump to search
m (Tantek moved page UserAgent to User agent: canonical spacing/caps per MDN and Wikipedia)
(see also)
Line 10: Line 10:
  var ua = navigator.userAgent;
  var ua = navigator.userAgent;


== Around this topic ==
== See Also ==
* [[Firefox/User Agent]]
* [[UA/override|User Agent Override]]
* [[UA/override|User Agent Override]]
* [[Compatibility/UADetectionLibraries|User Agent Detection Libraries]]
* [[Compatibility/UADetectionLibraries|User Agent Detection Libraries]]

Revision as of 19:13, 10 July 2024

User Agent string is a string which is visible in the HTTP headers of an HTTP client and in the navigator.userAgent object JavaScript for JS enabled client.

Never trust the user string to be accurate - many tablets and phones especially may mislead. To confirm the ability of the browser/platform use a specific test where available.

HTTP

For example on Firefox OS devices.

User-Agent: Mozilla/5.0 (Mobile; rv:18.0) Gecko/18.0 Firefox/18.0

Browsers with JavaScript

var ua = navigator.userAgent;

See Also