Internet Explorer – How to Edit User Agent String

internet explorerinternet-explorer-11user-agentwindows 7

OS: Windows 7/8
Browser: Internet Explorer 11
Platform: x86

How can I edit the user agent string on a machine to be universally seen by server-side code and web server logs? This needs to be a permanent, deployable solution, so something like using the Developer Tools likely won't work long-term.

The only way I've been able to set/modify a user agent string for Internet Explorer so that it is seen by a remote web server is to use the following registry key\value:

Key:   HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\CurrentVersion\Internet Settings\User Agent\Version
Value: SomeTestString
Data:  NULL

The above is what apparently is utilized by the Group Policy setting Windows Components\Internet Explorer\Customize User Agent String.

If you add the key/value as shown above, your user agent would appear as something like Mozilla/5.0 (SomeTestString; Windows NT 6.3; WOW64; Trident/7.0; rv:11.0) like Gecko
Unfortunately, this prepends the custom string you add to the user agent string, which breaks many Google sites and Netflix (and probably many many more)

Using another registry key/value I found will show the user agent string via a JavaScript query, but it does not appear in the web site logs (not visible to the server):

Key:   HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Internet Settings\5.0\User Agent
Value: SomeTestString
Data:  NULL

If you look in the web server's logs, you see only something like this: Mozilla/5.0 (Windows NT 6.3; WOW64; Trident/7.0; rv:11.0) like Gecko, but if you hit a page that uses JavaScript to show the user agent, you see something like this: Mozilla/5.0 (Windows NT 6.3; WOW64; Trident/7.0; .NET4.0E; .NET4.0C; .NET CLR 3.5.30729; .NET CLR 2.0.50727; .NET CLR 3.0.30729; Tablet PC 2.0; SomeTestString; rv:11.0) like Gecko.

Any advice is appreciated, as I'm stuck with a string that breaks some sites if utilized. Note that we do need to specify a custom item in the user agent string to support a 3rd-party platform that we cannot control.

Best Answer

This was possible at one point in time, but the feature has been deprecated and is no longer directly supported.

The difference between the user agent string reported during HTTP negotiation ("seen by the server") and the value reported through the DOM property is a deliberate change designed (in part) to cope with people overloading the user-agent string in precisely this fashion.

The first article describes a set of registry values that adjusted the DOM user agent string at one time; it's possible that the Post Platform settings continue to work. You would need to adjust the settings for all client machines running the tool.

If the Post Platform changes don't pan out, you'll need to consider a different approach, perhaps one utilizing a cross-platform strategy.

Hope this helps...

-- Lance

Related Question