- cross-posted to:
- mildlyinfuriating@lemmy.world
- cross-posted to:
- mildlyinfuriating@lemmy.world
Long considered malicious website behavior (and defined as abusive by Google), back button hijack is starting to rear its ugly head again. The lower panel in the image is what tomshardware.com displays when the back button is selected. The enshittification continues.


Not without either breaking most SPAs (Single-Page Applications) or writing userscripts with site-specific logic.
The classic way of doing this crap was to make a placeholder page navigate to the article page. That leaves the redirect page in the history stack so when the user presses the back button, it just opens the page that navigates them forward again.
The modern way is to use the history API with
history.pushStateto add a history entry while listening for thepopStateevent to check if the user pressed the back button. Unfortunately, both of those features have a legitimate use case for enabling navigation within a SPA. Writing an extension to replace them with no-ops would, in the best case, break page history in SPA websites. In the worst case, it would break page routing entirely.You might be able to get away with conditionally no-oping their functionality based on heuristics such as “only allow pushState if the user interacted with the page in the last 5 seconds,” but it would still end up breaking some websites.
Honestly though, as both a developer and a user SPAs could get fucked for all I care. I don’t think it’s a requirement of SPAs, but they seem to do so much unnecessary bullshit. So many bad development practices. I don’t hate the concept of SPAs, but it’s clearly just asking too much of the average contract developer.
As a developer as well, I agree that they can get fucked. Bloated crap that wastes bandwidth and ruins first-time-to-paint on mobile devices by necessitating downloading and initializing a multi-megabyte bundle of npm packages.
As a user of the internet, I need websites to work, however. I would have disabled JavaScript entirely by now if it weren’t for the fact that doing so renders what feels like half of the entire web unusable.