winforms - How to handle "window.Close" JS in a WebBrowser in c# -
i have code program library, have embed web browser website web browser can’t close. have cancel closing when user clicks on button in js closing window (window.close) program crash. add :
htmldocument htmldocument = this.webbibliotheque.document; htmldocument.window.unload += new htmlelementeventhandler(window_unload);
when document charged. code works , gets catch evenment don’t know have in function :
void window_unload(object sender, htmlelementeventargs e) { }
can me please?
you should handle windowclosing
event on underlying webbrowser
activex control (webbrowser.activexinstance
). there option cancel (disclaimer: untested). check this answer more details on how handle "raw" webbrowser events this.
Comments
Post a Comment