Howto (1): shielding hyperlinks in the webbrowser Control

Source: Internet
Author: User

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.

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.