我正在开发一个包含Web浏览器功能的项目,但问题是当javascript命令创建一个新的选项卡/新窗口时,它会在新的IE窗口中打开。
(请注意:我不谈论点击链接创建一个新窗口,它在 javascript 中)
我的代码创建了新标签和新的网络浏览器,但它没有加载网页。我该怎么做?
Private Sub WebBrowser1_NewWindow(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles WebBrowser1.NewWindow
Dim wb As New WebBrowser
Label3.Text = "Flagged New Window"
'make tab control page
e.Cancel = True
Dim myTabPage As New TabPage()
myTabPage.Text = "New Page" & (TabControl1.TabPages.Count + 1)
TabControl1.TabPages.Add(myTabPage)
'
Label3.Text = "Created Tab Control"
'insert new web browser control into the new page
Label3.Text = "Inserted web browser control"
'suppress errors
'WebBrowser1.ScriptErrorsSuppressed = True;
Label3.Text = "Suppressed Errors"
'Get page
myTabPage.Controls.Add(wb)
wb.Navigate(sender.Url)
End Sub