Samie Bee
Samie Bee

Reputation: 1365

How to make VB.NET webbrowser controls look like a different Web Browser to websites

Some websites, especially the ones that are fancy with HTML 5 and whatnot, will verify the browser that you are using, and give you a little warning message like: "Warning you are using an untested browser" if your web browser isn't in their little white-list.

enter image description here

Sadly these websites do not recognize IE controls as being Internet Explorer Browsers, so sometimes they show unnecessary warnings/errors

Is there any feasible way for me to make my webbrowser control show up as Internet Explorer 9 instead of whatever it actually shows up for, that way if the website has already tested Internet Explorer 9 for functionality, it will not show any errors.

Thank you!

Upvotes: 1

Views: 7750

Answers (2)

EricLaw
EricLaw

Reputation: 57115

The problem you're hitting is that, by-default, IE Web Browser controls run in legacy Compatibility modes. To resolve that, set Feature_Browser_Emulation for your process (ensure you write to both the 32bit and 64bit registry keys if your project is compiled for AnyCPU. See webbrowser using ie10 c# winform for more details.

If you wanted to send a different user-agent string (which is such sites determine what browser version you're using) you need to use the URLMon API UrlMkSetSessionOption as discussed here: http://blogs.msdn.com/b/ieinternals/archive/2009/10/08/extending-the-user-agent-string-problems-and-alternatives.aspx

Upvotes: 1

Yuriy Galanter
Yuriy Galanter

Reputation: 39787

By default WebBrowser control is detected as IE7, to see this - try to navigate to "What is My User Agent":

WebBrowser1.Navigate("http://www.whatsmyuseragent.com/")

Easiest way to change this is to pass user agent of a different browser as the last parameter of "Navigate" method. Open http://www.whatsmyuseragent.com/ in your normal IE9, copy the displayed string and use it as parameter e.g.:

WebBrowser1.Navigate("http://www.whatsmyuseragent.com/", Nothing, Nothing, "User-Agent: Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)")

Upvotes: 2

Related Questions