I think you are misunderstanding what is possible with the history API.
Pages can’t read your navigation history.
Pages can’t manipulate history prior to their loading.
The original history API is a careless mistake. It can:
Tell the browser to navigate forward n entries.
Tell the browser to navigate backward n entries.
See the length of the history stack.
Seeing the length is a privacy problem. Allowing arbitrary forward navigation is a usability problem that’s ripe for abuse. Allowing back navigation to be more than a single page is a usability problem.
The newer pushState and replaceState APIs are fine. As their names imply, they push a new URL or replace the current URL in the navigation stack. The URLs are also subject to same-origin constraints, so you can’t just replace the current page with an entirely different domain.
Using a replaceState followed by pushState to insert a dummy marker that runs history.go(1) when the popState event is fired allows pages to prevent users from navigating away from the website. That’s shitty and abusive, yes.
Back button hijacking is an infuriating problem, but it’s not a new one exclusive to SPAs. This fuckery has existed for a long time.
Edit: I don’t like the state of the modern web either, but as you also noted, the problem with it is by and large Google’s monopolistic dominance over web browsers and their incentive to not take privacy seriously. The only non-Blink browser engine with any notable market share is WebKit2, and that’s only because Apple is abusing their own position.
I think you are misunderstanding what is possible with the history API.
Pages can’t read your navigation history.
Pages can’t manipulate history prior to their loading.
The original history API is a careless mistake. It can:
nentries.nentries.Seeing the length is a privacy problem. Allowing arbitrary forward navigation is a usability problem that’s ripe for abuse. Allowing back navigation to be more than a single page is a usability problem.
The newer
pushStateandreplaceStateAPIs are fine. As their names imply, they push a new URL or replace the current URL in the navigation stack. The URLs are also subject to same-origin constraints, so you can’t just replace the current page with an entirely different domain.Using a
replaceStatefollowed bypushStateto insert a dummy marker that runshistory.go(1)when thepopStateevent is fired allows pages to prevent users from navigating away from the website. That’s shitty and abusive, yes.Do you know what else can do that, though?
Or
Back button hijacking is an infuriating problem, but it’s not a new one exclusive to SPAs. This fuckery has existed for a long time.
Edit: I don’t like the state of the modern web either, but as you also noted, the problem with it is by and large Google’s monopolistic dominance over web browsers and their incentive to not take privacy seriously. The only non-Blink browser engine with any notable market share is WebKit2, and that’s only because Apple is abusing their own position.