NewWindow3 event on extended WebBrowser

依然范特西╮ 提交于 2020-01-16 16:34:42

问题


I've got an extended WebBrowser control which handles the NewWindow3 event. Originally I wanted this because it exposes the Url property.

What I want to happen in this NewWindow event is to cancel opening a new IE instance (so I set E.Cancel = True). Then, I want to create a new form, a new web browser control and navigate to E.Url

This sort of works. Where I'm running into problems, is with some JavaScript. If I navigate to a page that needs to access it's opener (in this case, to write to a text box), it gets a JavaScript error.

My guess here is that this happens because the WebBrowser.Document.Window.Opener isn't set.

What can I do to make sure this is set? I've tried a couple of things including setting the ppDisp object to my new WebBrowser object but no joy there.

Editing as a pre-empt: I've tried GeckoFX, and that seems to have a bug in it on resending POST data. It's been reported but not acknowledged. I've also tried WebKit.NET which seems good but a little incomplete.


回答1:


This post explains how to handle this event http://blogs.artinsoft.net/mrojas/archive/2009/08/07/newwindow3.aspx



来源:https://stackoverflow.com/questions/2914922/newwindow3-event-on-extended-webbrowser

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!