How to manage the application from WebBrowser Control?

I was looking for him, but left empty. And the worst thing is that I know that this is possible.

In any case, I am developing an application that uses the WebBrowser to display information about an object (for example, Outlook with the Rules and Alerts dialog box).

My question is how to make a click on a WebBrowser hyperlink, for example, in any function in the form of Windows?

For example, let's say I have a link like this , and when I click it, I want the application to display a specific form, for example Outlook, when you click hyperlinks like People and Distribution List

+4
source share
2 answers

ChrisW's answer will work, but there is another way if you just rely on hyperlinks.

In Comicster , I have links in my WebBrowser control as follows:

 <a href="action:FileNew">New Collection</a> 

And then in the WebBrowser Navigating event, I have some code to check if the user tried to go to the โ€œaction:โ€ and intercept it:

 private void webBrowser1_Navigating(object sender, WebBrowserNavigatingEventArgs e) { if (e.Url.Scheme == "action") { e.Cancel = true; string actionName = e.Url.LocalPath; // do stuff when actionName == "FileNew" etc } } 

With a bit of code, you can even parse the URL parameters and โ€œpass themโ€ into the action of your host application so that I can do things like:

 <a href="action:EditIssue?ID=1">Edit this issue</a> 

... that will open the properties dialog for the problem with identifier 1.

+8
source

All Articles