There are two main types of hyperlink: 1. Open hyperlink in this window; 2. Open hyperlink in a new window. The classification criteria are of course different manifestations when you click a hyperlink in the webbrowser control: the former directly opens a new page in the current webbrowser control, and the latter opens a new page in the Internet Explorer window.
In the webbrowser control, how does one block these hyperlink (that is, all hyperlinks are invalid and do not navigate to any pages after being clicked )?
1. You can setAllownavigationAttribute:
This. wbmain. allownavigation = false;
2. It is troublesome to open a hyperlink in a new window by canceling the newwindow operation of the webbrowser control:
This. wbmain.Newwindow+ = NewCanceleventhandler(Wbmain_newwindow );
Private void wbmain_newwindow (Object sender, canceleventargs E)
{
E. Cancel = true;
}
Note: The webbrowser control refers to the webbrowser control in vs2005.