我一直在喋喋不休地讨论谷歌,但似乎无法找到解决方案。我添加了一个reg键,一切正常,直到我想打开一个本地文件。我的代码中包含了我尝试过的评论片段,包括我尝试过的最后一段:
Imports System.IO
Public Class Form1
Private Sub WebBrowser1_DocumentCompleted(sender As Object, e As WebBrowserDocumentCompletedEventArgs) Handles WebBrowser1.DocumentCompleted
End Sub
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
'WebBrowser1.Navigate("C:\...\...\......\index.html")
'WebBrowser1.Navigate(Path.GetDirectoryName(System.Reflection.Assembly.GetEntryAssembly().Location) & "\index.html")
'WebBrowser1.Document.Write(IO.File.ReadAllText("index.html"))
'WebBrowser1.Navigate("file:///" & IO.Path.GetFullPath(".\index.html"))
'WebBrowser1.Navigate(App.Path & "\index.html")
Dim strLocation As String
strLocation = "c:\Users\...\...\...\index.html"
strLocation = "file://" & strLocation
WebBrowser1.Navigate(strLocation)
End Sub
End Class
每次测试之前,我都会构建,并将exe文件移动到同一文件夹中并运行它。我得到的只是一个空白页面,一段时间后“没有回复”并关闭。