Get Navigating event when JS opens a new browser window using WebBrowser control
I'm using C# / .NET 4. I have a form with a WebBrowser
component on it. I have loaded an external web page to the WebBrowser
component.
I have an event handler attached to the Navigating
event. This works for most things. however, one part of the web site I'm loading executes a window.open(url)
javascript command. This has the effect of opening a new IE window with the URL, and my event handler does not get called.
I need a solution that eith开发者_运维技巧er:
- Calls my event handler with the URL that is about to be opened, allowing me to capture the URL and cancel the event as usual.
- Replace the Javascript function (there are many JS functions) that calls
window.open(url)
with some JS equivalent that will open the new page in the same window, thereby calling my event handler.
Im not versed with the Webbrowser-control, but there is a NewWindow-Event, sounds like it's the thing you are looking for.
精彩评论