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
At a high level, the intervention ensures the back/forward buttons always navigate to a page the user either navigated to or interacted with. It 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 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. On desktop, the back button will be enabled in the browser UI, but clicking on it will do nothing. This will allow a user to long-press the button and navigate to a skippable entry explicitly, while still protecting against the same annoying/abusive experiences this intervention is intended for. For additional context, see NavigationController::ShouldEnableBackButton() and https://crbug.com/339188522.NavigationController::CanGoForward() and NavigationController::ShouldEnableForwardButton() for details.NavigationEntryImpl that is marked as skippable is the one that is pruned if max entry count is reached.