New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unexpected window.close() behavior #119
Comments
Thanks! Yes it looks like if we inject 'close()' the renderer process will end although the browser, GPU, and utility processes remain. |
I have a background watchdog thread that monitors for this condition and posts a quit message to the main thread, where everything is released. |
@nnemkin and @douglas-jordan, In our previous SDK release, we added the WindowCloseRequested event that should resolve your scenario. You can check it out here: https://docs.microsoft.com/en-us/microsoft-edge/hosting/webview2/reference/icorewebview2#add_windowcloserequested |
@pagoe-msft |
Hi @pagoe-msft @douglas-jordan I wanted to get trigger WindowCloseRequested event in one of my WebView2 use case scenario. I have attempted multiple ways but WindowCloseRequested event/event handler is not listing in my WebView2 core libraries. It is a VB.NET application and installed latest nuget version of WebView2 (1.0.1020.30). Could you please let me know how to implement or enable this functionality. Thanks in advance & much appreciated |
@champnic Thank you for the quick response. In my case I have been using WinForms and events are registered like this Friend WithEvents WebView21 As Microsoft.Web.WebView2.WinForms.WebView2 And I can able to use some events like this But here I couldn't use same for WindowCloseRequested. So could you please let me know same is available in WinForms or may I am wrong with some event usage ?. If then could you please provide me sample code of WindowCloseRequested event usage. |
@shyjusachin The WindowCloseRequested event is on the |
When a script calls window.close(), WebView2 destroys itself, leaving an empty black window behind.
I think the reasonable behavior for embedded WebViews would be to fire an event (new API) and do nothing.
The text was updated successfully, but these errors were encountered: