tryphotino / photino.Native

https://tryphotino.io
Apache License 2.0
142 stars 50 forks source link

Close Window Via `window.close()` #66

Closed 9ParsonsB closed 3 years ago

9ParsonsB commented 3 years ago

In CoreWebView2 you are able to listen to event CoreWebView2.WindowCloseRequested for when window.close() is called in javascript.

As per the dom-window-close spec this function is allowed:

if it is a top-level browsing context whose session history contains only one Document.

Could this functionality please be implemented?

MikeYeager commented 3 years ago

In the upcoming V2 there is a Closing event raised for the native window (which can even prevent the window from closing). There is also the built-in browser event for closing the webview control that can be used in JavaScript. Can you explain your scenario? Do you want to write a JavaScript handler or a C# handler? Thanks.

9ParsonsB commented 3 years ago

Hey, Thanks for your reply, love the project!

The Scenario is a full screen kiosk-style app that shows an animated webpage while it is doing some work in the background - in C#. Once this is done, the application closes the window and runs another application.

We are also looking at using photino for the aforementioned other application, but then we would need to be able to close the current window from javascript. This works if you run most browsers (as per spec) with an url as a parameter and dont navigate away.

This feature would also help circumvent the issues I am having as a result of tryphotino/photino.NET#52

ottodobretsberger commented 3 years ago

This should be fixed with the release of Photino v2. Please give it a try and let us know if the problem remains.

9ParsonsB commented 3 years ago

@ottodobretsberger Where can I get v2? I dont see a git tag?

MikeYeager commented 3 years ago

The V2 NuGet packages are available for use from NuGet.org. For source code, pull the latest 'master' branch in GitHub. We did not add tags.