Questions tagged [user-agent]

A user agent is a piece of software (a software agent) that acts on behalf of a user. The term is often used to refer to browsers, and other software that sends network requests. In the HTTP protocol, a user agent identifies itself to the server using a user-agent string. The user-agent string is a string in the header of an HTTP request that identifies the browser, version, device, os, and other information about the device from which the request came.

A user agent is a piece of software (a software agent) that acts on behalf of a user. The term is often used to refer to browsers, and other software that sends network requests. In the HTTP protocol, a user agent identifies itself to the server using a user-agent string. The user-agent string is a string in the header of an HTTP request that identifies the browser, version, device, os, and other information about the device from which the request came.

The user-agent usually consists of the web browser type, the client operating system and device identifier (all with versions or builds). There is not particular standard in how to formulate an user-agent, but browser and device vendors typically standardize within their own scope.

Detection User-agent detection can be hard, especially in the mobile world. Identification of client capabilities usually cannot be done via the user-agent, but must be obtained by looking up the user-agent in a database. The defacto standard user-agent for a device is the one created by its web browser.

2389 questions
100
votes
5 answers

Change user-agent for Selenium web-driver

I have the following code in Python: from selenium.webdriver import Firefox from contextlib import closing with closing(Firefox()) as browser: browser.get(url) I would like to print the user-agent HTTP header and possibly change it. Is it…
xralf
  • 3,312
  • 45
  • 129
  • 200
95
votes
1 answer

Why does Chrome use sec-ch-ua: "\"Not\\A;Brand";v="99"?

I understand that making user-agent hints more ambiguous is intended, in part, to make browser fingerprinting harder. My own (Windows desktop) Chrome sends the headers: user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML,…
Sai
  • 6,919
  • 6
  • 42
  • 54
91
votes
5 answers

What is the iOS 5.0 user agent string?

What is the iOS 5.0 user agent string? Here is the iOS 4.0 user agent: What is the iPhone 4 user-agent?
chown
  • 51,908
  • 16
  • 134
  • 170
89
votes
12 answers

Detect 64-bit or 32-bit Windows from User Agent or Javascript?

I want to offer the right version of a download. The versions I have are: 32-bit Windows 64-bit Windows Linux Detecting Linux using the User Agent field is easy; but is it possible to reliably figure out if Windows is 32-bit or 64-bit? Users…
user9876
  • 10,954
  • 6
  • 44
  • 66
88
votes
5 answers

How to detect Browser type in Django?

How can i detect which browser type the client is using. I have a problem where i have to ask people to use different browser (Firefox) instead of IE. How can i get this information. I know http request has this information (Header). How will i get…
AlgoMan
  • 2,785
  • 6
  • 34
  • 40
88
votes
4 answers

Changing User Agent in Python 3 for urrlib.request.urlopen

I want to open a url using urllib.request.urlopen('someurl'): with urllib.request.urlopen('someurl') as url: b = url.read() I keep getting the following error: urllib.error.HTTPError: HTTP Error 403: Forbidden I understand the error to be due to…
user3662991
  • 1,083
  • 1
  • 11
  • 11
85
votes
4 answers

Setting user agent of a java URLConnection

I'm trying to parse a webpage using Java with URLConnection. I try to set up the user-agent like this: java.net.URLConnection c = url.openConnection(); c.setRequestProperty("User-Agent", "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.4; en-US;…
DiglettPotato
  • 1,654
  • 3
  • 15
  • 19
80
votes
15 answers

Mocking a useragent in javascript?

I'm looking for a way to programmatically change navigator.userAgent on the fly. In my failed attempt to get an automated javascript unit tester, I gave up and attempted to begin using fireunit. Immediately, I've slammed into one of the walls of…
Stefan Kendall
  • 66,414
  • 68
  • 253
  • 406
73
votes
3 answers

What is the standard format for a browser's User-Agent string?

Is there an RFC, official standard, or template for creating a User Agent string? The iphone's user-agent string seems strange... Mozilla/5.0 (iPhone; U; CPU iPhone OS 3_1_2 like Mac OS X; en-us) AppleWebKit/528.18 (KHTML, like Gecko) Version/4.0…
John Himmelman
  • 21,504
  • 22
  • 65
  • 80
71
votes
3 answers

How to detect device name in Safari on iOS 13 while it doesn't show the correct user agent?

After Apple's iOS 13 release, I realized window.navigator.userAgent in Safari on iPad iOS 13 is same as on MacOS. Something like this: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0…
Saeid Amanzadeh
  • 713
  • 1
  • 5
  • 7
70
votes
1 answer

Why does Internet Explorer (9) report "Mozilla" in UserAgent?

Why does Internet Explorer has Mozilla in UserAgent? In Firefox it's stating: Mozilla/5.0 (Windows NT 6.1; rv:7.0.1) Gecko/20100101 Firefox/7.0.1 In Interner Explorer it's stating: Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0;…
Harsh Baid
  • 7,199
  • 5
  • 48
  • 92
68
votes
3 answers

What software is sending User-Agent "Test Certificate Info"?

Google is surprisingly mute on this issue. In my company's web software error logs, we're seeing multiple individuals with an Apache access log entry that has this in it: ... HTTP/1.1" 500 - "-" "Test Certificate Info" I have no clue what piece of…
ckrailo
  • 1,009
  • 1
  • 8
  • 13
66
votes
10 answers

What is the User Agent string name for Microsoft Edge?

I'm making a website and I want it to be compatible with the forthcoming Microsoft Edge when it comes out officially. To be more specific, the mobile version of it. Does anyone know what string will identify the Edge Mobile Browser (for example, "IE…
Zvonimir Matic
  • 831
  • 1
  • 8
  • 12
65
votes
5 answers

android user agent

I am writing an app in Android that uses a WebView to display HTML content. I was told to get an Android user agent for my app - how do I do that? I opened http://whatsmyuseragent.com from my app as well as the Android browser - both the user agents…
Sagar Hatekar
  • 8,700
  • 14
  • 56
  • 72
64
votes
2 answers

Way to change Google Chrome user agent in Selenium?

I'm trying to figure out a way whereby whenever I open up Chrome via Selenium (in Python) in this particular script, the Chrome page automatically opens up with another user agent selected - in this case, Microsoft Edge Mobile (but I will be…