简体   繁体   English

如何处理/捕捉在VB.Net 2008中的WebBrowser控件内单击的链接

[英]How to Handle/Catch the Link Clicked inside WebBrowser Control in VB.Net 2008

I have a WebBrowser control inside a VB.Net 2008 application. 我在VB.Net 2008应用程序中有一个WebBrowser控件。

When I click a link inside the WebBrowser, it opens a new Internet Explorer Window. 当我单击WebBrowser内的链接时,它将打开一个新的Internet Explorer窗口。 I do not handle the web page so I cannot in any way modify the Target property. 我不处理网页,因此我无法以任何方式修改Target属性。

Is there a way in VB.Net to catch the Clicked Link and have it display inside the particular WebBrowser Control? VB.Net中是否可以捕获单击的链接并将其显示在特定的WebBrowser控件内?

Try this: 尝试这个:

private void myWebBrowser_NewWindow(object sender, System.ComponentModel.CancelEventArgs e)
{
    e.Cancel = true;
    myWebBrowser.Navigate(myWebBrowser.StatusText);
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM