New here, sorry if I missed something...
I'm trying to display a local html file in WebBrowser1 that contains javascript that retrieves data from the internet. The graphs are not displayed, only the title. It works fine in Edge, IE, Firefox and Chrome on my computer. If I load the website on the internet and log in, the graphs is displayed. But I have to use the file from a local html page because it is customized for my purpose. What have I missed?
Imports System.IO
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
WebBrowser1.ScriptErrorsSuppressed = True
Dim filePath As String
filePath = Application.StartupPath & "\Winningtemp.html"
WebBrowser1.Url = New Uri(filePath)
WebBrowser1.Refresh()
End Sub
The HTML-file Winningtemp.html:
<body>
<script type="text/javascript" id="***">
Script follows here... Can't show the code, sorry...
</script>
</body>
I'm using Visual Studio Express 2017.
It seems to be caused by a low WebBrowser Emulation version.
Private Sub sub_WebBrowser_lastVersionEmulation(Optional ByVal IsDefaultVersion As Boolean = False)
'WebBrowser Emulation
Try
Dim VersionCode As Integer
Dim Version As String = ""
Dim ieVersion As Object = Microsoft.Win32.Registry.LocalMachine.OpenSubKey("Software\Microsoft\Internet Explorer").GetValue("svcUpdateVersion")
If ieVersion Is Nothing Then
ieVersion = Microsoft.Win32.Registry.LocalMachine.OpenSubKey("Software\Microsoft\Internet Explorer").GetValue("Version")
End If
If ieVersion IsNot Nothing Then
Version = ieVersion.ToString.Substring(0, ieVersion.ToString.IndexOf("."c))
Select Case Version
Case "7"
VersionCode = 7000
Case "8"
VersionCode = 8888
Case "9"
VersionCode = 9999
Case "10"
VersionCode = 10001
Case Else
If CInt(Version) >= 11 Then
VersionCode = 11001
Else
Throw New Exception("IE Version not supported")
End If
End Select
Else
Throw New Exception("Registry error")
End If
Dim AppName As String = ""
''AppName = My.Application.Info.AssemblyName
AppName = System.Diagnostics.Process.GetCurrentProcess().ProcessName
Dim sRoot As String = "HKEY_CURRENT_USER\"
Dim sKEY As String = "Software\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION"
If IsDefaultVersion = False Then
'Check if the right emulation is set
'if not, Set Emulation to highest level possible on the user machine
Dim CurrentSetting As String = CStr(Microsoft.Win32.Registry.CurrentUser.OpenSubKey(sKEY).GetValue(AppName & ".exe"))
If CurrentSetting Is Nothing OrElse CInt(CurrentSetting) <> VersionCode Then
Microsoft.Win32.Registry.SetValue(sRoot & sKEY, AppName & ".exe", VersionCode)
Microsoft.Win32.Registry.SetValue(sRoot & sKEY, AppName & ".vshost.exe", VersionCode)
End If
Else
'Default Version
Microsoft.Win32.Registry.SetValue(sRoot & sKEY, AppName & ".exe", 10001)
Microsoft.Win32.Registry.SetValue(sRoot & sKEY, AppName & ".vshost.exe", 10001)
End If
Catch ex As Exception
'skip
End Try
End Sub