When sending a HTTP request, IE sends the User-Agent variable to the server. A possible value (as seen by the network debugger):
User-Agent: Mozilla /5.0 (Compatible MSIE 9.0;Windows NT 6.1;WOW64; Trident/5.0)
My question: How does IE (or any other browser) find out this variable? I'm asking this because when visiting some websites, this variable is different than others and I'd like to trace where the change is coming from. 'Compatibility settings' is one option, but I think there is more to it.
Can anyone explain the process of this variable?
The User-Agent request header is a characteristic string that lets servers and network peers identify the application, operating system, vendor, and/or version of the requesting user agent.
The HTTP headers User-Agent is a request header that allows a characteristic string that allows network protocol peers to identify the Operating System and Browser of the web-server. Your browser sends the user agent to every website you connect to.
In the Home pane, double-click HTTP Response Headers. In the HTTP Response Headers pane, click Add... in the Actions pane. In the Add Custom HTTP Response Header dialog box, set the name and value for your custom header, and then click OK.
An HTTP header consists of its case-insensitive name followed by a colon ( : ), then by its value.
The User-Agent appears in an HTTP Request Header, not an HTTP Response one. In general, the request is sent from browser to the web application. So the user-agent variable is filled by the browser. Different browsers will fill up this field with different values.
About how IE find those variables, I think you are asking about User-Agent Registry Keys.
You can also override certain tokens of the user-agent string by adding values to the following registry key.
HKEY_LOCAL_MACHINE (or HKEY_CURRENT_USER) SOFTWARE Microsoft Windows CurrentVersion Internet Settings 5.0 User Agent (default) = "Mozilla/4.0" Compatible = "compatible" Platform = "Windows NT 5.1" Version = "MSIE 6.0" Pre Platform Token = Value Post Platform Token = Value
The default value of the User Agent key replaces the application name and application version tokens reported in the user-agent string. Be aware that the first seven characters are used for the application name, and the remaining characters specify the application version token.
The Compatible, Platform, and Version values replace the corresponding tokens in the user-agent string.
Additional tokens can be added to the user-agent string by using the Registry Editor to create new string values under the Pre-Platform key or Post-Platform key. The value name should be the complete token; the value data is ignored. Tokens added to the Pre-Platform key appear before the platform token in the final user-agent string. Tokens added to the Post-Platform key appear after the platform token in the final user-agent string. Multiple tokens in either the Pre-Platform key or Post-Platform key are displayed in an unpredictable order.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With