I'm doing an advanced browser and edited a lot in it to remove script errors and render the page better, but I'll share a part of my code to see if it can help.
'Coloque isso no método iniciador da forma principal (Form1)
ServicePointManager.ServerCertificateValidationCallback = New RemoteCertificateValidationCallback(Function() True)
Ok, so it will ignore certificate errors, but this will not make sense now, put that line, has to be the first expression of the Load
event of your WebBrowser
:
'Ao carregar seu Webbrowser (WebBrowser1.Load):
WebBrowser1.ScriptErrorsSuppressed = True
WebBrowser is rendered by the Internet Explorer 7 renderer (unfortunately), but fortunately we can put it to the highest version, in case IE 11 .
This part is what will make the most difference, put this code in the Application.Designer.vb file
Located in your project directory, go to the My Project folder and the file will be there.
Put this method Namespace My.MyApplication
:
Private Sub MyApplication_Startup(ByVal sender As Object, ByVal e As Microsoft.VisualBasic.ApplicationServices.StartupEventArgs) Handles Me.Startup
CreateBrowserKey()
End Sub
Private Sub MyApplication_Shutdown(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Shutdown
' Se quiser que remova a propriedade:
' 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 'Internet Explorer 8
If IgnoreIDocDirective Then
value = 8888
Else
value = 8000
End If
Case 9 'IE 9
If IgnoreIDocDirective Then
value = 9999
Else
value = 9000
End If
Case 10 'IE 10
If IgnoreIDocDirective Then
value = 10001
Else
value = 10000
End If
Case 11 'IE 11
If IgnoreIDocDirective Then
value = 11001
Else
value = 11000
End If
Case Else ' não achou o ie?!
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
Try to do this, hugs!
Tip: If you can not find the file, place these methods on Form1.