Reference: PSA on blink-dev
Some pages make it difficult or impossible for the user to use the browser back button to go back to the page they came from. Pages accomplish this using redirects or by manipulating the browser history, resulting in an abusive/annoying user experience.
The history manipulation intervention mitigates such abuse by making the browser’s back button skip over pages that added history entries or redirected the user without ever getting a user activation. Note that the intervention only impacts the browser back/forward buttons and not the history.back()/forward()
APIs.
Here’s an example:
pushState
or navigates the user to another page (c.com) without ever getting a user activation.Because this only impacts browser UI, this is allowed by the spec, which only governs the behavior of history.back/forward
. However, it might be good to spec this anyway, so that users get consistent experiences in all browsers. That work is tracked at https://github.com/whatwg/html/issues/7832
The intervention guarantees the following invariants:
should_skip_on_back_forward_ui_
member for a NavigationEntryImpl
object. The member is initially set to false, and it is set to true if any document in the page adds a history entry without having a user activation.NavigationController::CanGoBack()
will return false if all entries are marked to be skipped on back/forward UI. On desktop this leads to the back button being disabled. On Android, pressing the back button will close the current tab and a previous tab could be shown as it would normally happen on Android when the back button is pressed from the first entry of a tab.NavigationEntryImpl
that is marked as skippable is the one that is pruned if max entry count is reached.