openui5 icon indicating copy to clipboard operation
openui5 copied to clipboard

fix: Never use unload event on modern browsers

Open mauriciolauffer opened this issue 5 years ago • 2 comments

Window unload event is extremely unreliable, it doesn't fire in multiple scenarios, especially in mobiles. Replacing "unload" by "pagehide" event.

PR for issue https://github.com/SAP/openui5/issues/3085

https://developers.google.com/web/updates/2018/07/page-lifecycle-api?utm_source=lighthouse&utm_medium=devtools#legacy-lifecycle-apis-to-avoid https://web.dev/bfcache/ https://developer.mozilla.org/en-US/docs/Web/API/Window/unload_event

mauriciolauffer avatar Nov 25 '20 22:11 mauriciolauffer

CLA assistant check
All committers have signed the CLA.

CLAassistant avatar Nov 25 '20 22:11 CLAassistant

Pull request is going to be reviewed as part of BLI CPOUI5FRAMEWORK-203.

alexandar-mitsev avatar Apr 23 '21 17:04 alexandar-mitsev

Dear @mauriciolauffer,

thank you for your contribution by providing the PR. We already addressed the browser-side deprecation of the 'unload' event within sap/ui/core with the changes below.

We discussed the possible solutions internally and came to the conclusion that we are not able to keep the exact behavior working, since the deprecation of the 'unload' event also activates the BF cache in many cases. Therefore we decided to deprecate the 'wrapper' APIs on the Component and to remove the usage of the 'unload' event in the most other cases, since they were not needed there at all.

Anyway many thanks for your contribution!

Kind regards, Johannes

H4ze avatar Oct 24 '23 15:10 H4ze