Replace deprecated 'unload' with modern 'pagehide' event listener#2130
Open
bschwarzent wants to merge 1 commit intoreleases/24.2from
Open
Replace deprecated 'unload' with modern 'pagehide' event listener#2130bschwarzent wants to merge 1 commit intoreleases/24.2from
bschwarzent wants to merge 1 commit intoreleases/24.2from
Conversation
When the user leaves the current page (either because they close the tab or navigate away) or just simply reloads the page, the UI session should be disposed. Otherwise, UI sessions might accumulate if the HTTP session itself is still in use. To notify the UI server about a disposed UI session, a window listener for the 'unload' event was used. Recently, some browsers have declared the 'unload' event to be obsolete and started to ignore it by default [1]. To make sure UI sessions are still disposed on the UI server when no longer in use, the event listeners have to changed to the more modern 'pagehide' event. However, using this event can under some circumstances enable the browser's back/forward cache [2]. This would store and restore the previous state of a page for a faster user experience. Since this can potentially cause problems for Scout Classic applications, we simply reload the page when being restored from the bfcache to make sure the state in the browser is up-to-date. Some old Jasmine contained a call to a special JasmineScout method uninstallUnloadHandlers(). This method has not been necessary or useful for several years. Therefore, it was removed. [1] https://developer.chrome.com/docs/web-platform/deprecating-unload [2] https://web.dev/articles/bfcache 454776
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When the user leaves the current page (either because they close the tab or navigate away) or just simply reloads the page, the UI session should be disposed. Otherwise, UI sessions might accumulate if the HTTP session itself is still in use. To notify the UI server about a disposed UI session, a window listener for the 'unload' event was used.
Recently, some browsers have declared the 'unload' event to be obsolete and started to ignore it by default [1]. To make sure UI sessions are still disposed on the UI server when no longer in use, the event listeners have to changed to the more modern 'pagehide' event. However, using this event can under some circumstances enable the browser's back/forward cache [2]. This would store and restore the previous state of a page for a faster user experience. Since this can potentially cause problems for Scout Classic applications, we simply reload the page when being restored from the bfcache to make sure the state in the browser is up-to-date.
Some old Jasmine contained a call to a special JasmineScout method uninstallUnloadHandlers(). This method has not been necessary or useful for several years. Therefore, it was removed.
[1] https://developer.chrome.com/docs/web-platform/deprecating-unload
[2] https://web.dev/articles/bfcache
454776