Friday, September 14, 2018

addWindowClosingHandler only working in IE

GWT 2.8.2

In below code neither of the Window.alerts gets triggered in Chrome, FF and Edge.
This does not work neither while in SuperDevMode, or when fully compiled and deployed.

Only works in IE



The "go" alert is displayed by all browsers so I am sure the code was executed...


Any ideas anyone ?
Should I detect browser closing/tab closing/navigating to another URL in another way in these other browsers ?

I also tried using the deprecated Window.addWindowCloseListener. This actually does work in Edge (while the new handlers don't work in Edge). But not in Chrome and FF.



Window.addWindowClosingHandler(event ->
{
Window.alert("onWindowClosing");
});

Window.addCloseHandler(new CloseHandler<Window>()
{
@Override public void onClose(CloseEvent<Window> event)
{
Window.alert("onWindowClosed");
}
});

Window.alert("go");




--
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment