Internet Explorer 9 userAgent bug fix with the WebBrowser control.
I have worked out how to fix the userAgent bug with Internet Explorer 9 beta.
When in IE7 mode with Internet Explorer 9 the full string is returned,
but in IE8 and IE9 modes only return "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)".
(Note: Internet Explorer 8 is ok as the full string in IE7 and IE8 mode is returned)
Until this bug is fixed with IE9, you can return the full userAgent string by;
First check if you are in IE7 mode with:
YourAppexe.exe = ???
If YourAppexe.exe =7000 then in IE7 mode, userAgent is ok, so exit code.
If YourAppexe.exe >7000 then ...
You should also check if this is 'IE9 beta' as hopefully the userAgent bug will be fixed in later versions.
Read all the values in:
HKEY_LOCAL_MACHINE (and HKEY_CURRENT_USER)\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings\5.0\User Agent\Pre Platform (and Post Platform)
Put all the values into one string and store it at
HKEY_LOCAL_MACHINE (or HKEY_CURRENT_USER)\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings\5.0\User Agent
Platform = ...
* See below.
Your application can now load the WebBrowser control.
So this information will not be added to other applications, as soon as the WebBrowser control has loaded delete the registry 'Platform' value.
As you are replacing the Platform string with your new string, you should also add the operating platform name to the string.
Platform = "Windows NT 6.1" + "SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; .NET4.0E; AskTbARS/188.8.131.5204
Netscape and Netscape clones have never returned the full userAgent string.
EG. Mozilla/5.0 (Windows; U; Windows NT 6.1; en-GB; rv:184.108.40.206) Gecko/20100914 SeaMonkey/2.0.8