开发者

Get Navigating event when JS opens a new browser window using WebBrowser control

开发者 https://www.devze.com 2023-01-21 00:59 出处:网络
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'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:

  1. 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.
  2. 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.

0

精彩评论

暂无评论...
验证码 换一张
取 消