I am facing another problem that has to do with the IE the web browser uses by default. Some computers aren't able to run the website properly and face errors, so I want to change the browser in something that will work on everyone. I tried shells, etc but I want the website to open on the webbrowser. Also the webbrowser doesn't have any buttons textboxes and I want that page by default. Can anyone help?
Asked
Active
Viewed 8,467 times
2
-
duplicate of how to use Chrome, WebKit or Gecko as browser control: http://stackoverflow.com/q/790542/1070452 – Ňɏssa Pøngjǣrdenlarp Jun 22 '14 at 12:24
-
They don't give a valid answer to actually solve the problem. – Tonakis2108 Jun 22 '14 at 13:03
-
It all depends on the installation of your users (the WebBrowser control uses the installed IE version). You should set some prerequisites for your application, like "minimum version of IE = X". Also make sure the WebBrowser control doesn't use an older IE compatibility mode (if IE8 is installed, it uses in some cases the IE7 compatibility). – Styxxy Jun 22 '14 at 13:34
-
Actually the one that tried to use it said he had IE 11 on windows 7 and got the cannot display webpage that had half of the url in it. – Tonakis2108 Jun 22 '14 at 13:36
2 Answers
1
You can have a look at my question on MSDN Forum on how to change which version of IE the WebBrowser control uses:

Visual Vincent
- 18,045
- 5
- 28
- 75
-
For now I'll use firefox (geckoFX) and I'll follow the question on MSDN. Thanks. :) – Tonakis2108 Jun 22 '14 at 14:52
1
create a form called Form1 or just name accordingly, delete everything with its code and paste with below, now you will be surfing using the current installed IE.
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
CreateBrowserKey()
'Below code adds a custom useragent, adding a custom useragent does not change the actual engine...thats why we need to do all this coding.
WebBrowser1.Navigate("http://www.whatsmybrowser.org", "_top", Nothing, "User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.130 Safari/537.36")
'This goes to the website using default user agent.
'WebBrowser1.Navigate("http://www.whatsmybrowser.org")
End Sub
Private Sub Form1_FormClosing(ByVal sender As Object, ByVal e As FormClosingEventArgs) Handles Me.FormClosing
RemoveBrowerKey()
End Sub
Private Const BrowserKeyPath As String = "\SOFTWARE\Microsoft\Internet Explorer\MAIN\FeatureControl\FEATURE_BROWSER_EMULATION"
Private Sub CreateBrowserKey(Optional ByVal IgnoreIDocDirective As Boolean = False)
Dim basekey As String = Microsoft.Win32.Registry.CurrentUser.ToString
Dim value As Int32
Dim thisAppsName As String = My.Application.Info.AssemblyName & ".exe"
' Value reference: http://msdn.microsoft.com/en-us/library/ee330730%28v=VS.85%29.aspx
' IDOC Reference: http://msdn.microsoft.com/en-us/library/ms535242%28v=vs.85%29.aspx
Select Case (New WebBrowser).Version.Major
Case 8
If IgnoreIDocDirective Then
value = 8888
Else
value = 8000
End If
Case 9
If IgnoreIDocDirective Then
value = 9999
Else
value = 9000
End If
Case 10
If IgnoreIDocDirective Then
value = 10001
Else
value = 10000
End If
Case 11
If IgnoreIDocDirective Then
value = 11001
Else
value = 11000
End If
Case Else
Exit Sub
End Select
Microsoft.Win32.Registry.SetValue(Microsoft.Win32.Registry.CurrentUser.ToString & BrowserKeyPath, _
Process.GetCurrentProcess.ProcessName & ".exe", _
value, _
Microsoft.Win32.RegistryValueKind.DWord)
End Sub
Private Sub RemoveBrowerKey()
Dim key As Microsoft.Win32.RegistryKey
key = Microsoft.Win32.Registry.CurrentUser.OpenSubKey(BrowserKeyPath.Substring(1), True)
key.DeleteValue(Process.GetCurrentProcess.ProcessName & ".exe", False)
End Sub
End Class

Uriahs Victor
- 1,049
- 14
- 32
-
-
That's not gonna work as you've declared browser user-agent on this line: `WebBrowser1.Navigate("http://www.whatsmybrowser.org", "_top", Nothing, "User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.130 Safari/537.36")` If you remove this line and then manually navigate to whatsmybrowser, you'll get IE, not Chrome. **Nice try tho :P** – Stefan Đorđević Apr 29 '17 at 21:42