onDetach() not being called on some browser

I’ve noticed that onDetach is not called when closing the browser/tab in Firefox (PC) and every mobile browser, works on Edge (PC). Reload works everywhere.

Is there any workaround?

EDIT

x.getUi().getSession().getState() is OPEN even if the browser is closed

It depends on the version. Latest version should immediately detach; older version need some time.

Thank you, I’m using 24.3.10

@Matti Do you remember some gotchas about mobile browsers about your little feature? :wink:

Just tested that Firefox and Safari appears to have regressed. Detact even not working with them eagerly with the beacon request.

Created an issue to track this: Beacon API based eager UI closing is broken on Firefox and Safari · Issue #19305 · vaadin/flow · GitHub

1 Like