WebBrowser and javascript window.close()

后端 未结 5 1923
挽巷
挽巷 2020-12-19 02:31

If I host a WebBrowser in my application, and a javascript code in the web page shown on my WebBrowser calls window.close() and I click \"Yes\" on

5条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-19 03:01

    Which version of the WebBrowser control are you using? The WinForms one or the WPF one?

    For the WinForms control, you can try to handle the Disposed or the HandleDestroyed event of the WebBrowser control in order to close your parent form too. For the WPF control, you can try the same with the Unloaded event.

    I don't know if other JS code can lead to the same problems.

提交回复
热议问题