-1

Does anyone have any idea how can i open new window at click on any dynamic link and my problem platform is vb.net and also remember that new window is not internet explorer window or any other browser give me full source code.

This is what I've tried till now

Private Sub WebBrowser1_NewWindow(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles WebBrowser1.NewWindow
    Dim thiselement As HtmlElement = WebBrowser1.Document.ActiveElement
    Dim targeturl As String = thiselement.GetAttribute("href") 
    e.Cancel = True
    Dim window As New Form1
    window.Show()
    window.WebBrowser1.Navigate(targeturl)
End Sub
4

2 回答 2

0

您也可以尝试使用 javascript 打开窗口

   Private Sub WebBrowser1_NewWindow(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles WebBrowser1.NewWindow

    Dim thiselement As HtmlElement = WebBrowser1.Document.ActiveElement
    Dim targeturl As String = thiselement.GetAttribute("href") 
         Response.Write("<script>window.open('"+targeturl+"','_ new', 'width=400,height=200');</script>")
   End Sub
于 2013-10-03T08:21:18.210 回答
0

只需下载 WebBrowserEx 服务并安装在项目的 bin 文件夹中的调试和运行文件夹中。然后在您的项目中使用此服务浏览器。

于 2013-11-14T07:19:10.400 回答