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

Popular posts from this blog

java - WrongTypeOfReturnValue exception thrown when unit testing using mockito -

php - Magento - Deleted Base url key -

android - How to disable Button if EditText is empty ? -