日期:2014-05-17 浏览次数:20969 次
private void WebBrowser1_NewWindow(Object sender, CancelEventArgs e)
{
string url = wbBrowser.Document.ActiveElement.GetAttribute("href");
if (url != string.Empty)
{
wbBrowser.Navigate(url);
}
e.Cancel = true;
}
private void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
{
foreach (HtmlElement archor in this.webBrowser1.Document.Links)
{
archor.SetAttribute("target", "_self");
}
foreach (HtmlElement form in this.webBrowser1.Document.Forms)
{
form.SetAttribute("target", "_self");
}
}