Here's an example of some website madness, the Major League Baseball standings page on ESPN: https://www.espn.com/mlb/standings
Click on the link for a team name, such as the New York Yankees, and it takes you to the team page: https://www.espn.com/mlb/team/_/name/nyy/new-york-yankees
Now click the back button in your browser, and it takes you back to the standings page. Going back ought to be instantaneous, because the standings page ought to be in the browser's page cache. Yet it's not instantaneous. The page reloads every time! Indeed, the New York Yankees page also reloads every time you click the forward button. What's going on?
Appearances can be deceiving. When you click on a link, the standings page hijacks the click event, presumably for tracking purposes. It then uses the history.pushState() method to change the URL in the address bar. So in a sense, the link navigation has been faked. The page then listens for a popstate event, which is triggered when you click the back button. Then it reloads the standings page. If I hijack the popstate
event myself, for testing purposes, the URL changes back to https://www.espn.com/mlb/standings
but the page still displays the New York Yankees! Everything is faked. History has been faked.
How can you stop this website madness? With my web browser extension StopTheMadness, of course! Specifically, you'd want to enable the Protect all links website option. Here's a screen recording I took to demonstrate, both before and after enabling Protect all links.
Protect all links prevents the page from hijacking the link click, so you get a real page navigation instead of a fake navigation. You'd probably want to add URL-specific website options for espn.com
instead of enabling Protect all links in the Default options for all websites, because as the StopTheMadness popup window says, Protect all links can cause "widespread site breakage". In this case, however, Protect all links causes specific site fixage!
Is "fixage" a word? Anyway, this blog post has been brought to you by StopTheMadness. Word!