Web Browser Control LoadCompleted Event Not Firing

不羁岁月 提交于 2020-01-02 10:29:13

问题


Hopefully someone can help.

I've created a user control which hosts a Web Browser control I've added this control to my new project. When I start the application and view the control the web site is loaded correctly and the LoadCompleted Event fires ok.

However I actually initialize the control from another class and ask it to navigate to the page in the background (I invoke the UI Thread), I see the navigate method get called but the LoadCompleted Event never fires until you view the form which the Web Control is hosted on.

It seems that the Web Browswer control is only rendered when the form is viewed. I need the Broswer to fully load the page because I'm invoking JavaScript functions which need to be ready for when the user looks at the form containing the web page.

Is there any way to force the browser to render the content without actually showing the page?

Thanks


回答1:


Hosted WinForms Web Browser as suggested by Noseratio.



来源:https://stackoverflow.com/questions/19102844/web-browser-control-loadcompleted-event-not-firing

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