Occasionally I see links like the following (don't visit this on your main computer) that I am redirected to on Google. The back button will either redirect back to the page, or some other questionable content. These pages are almost always some scam or phishing attempt, and I wonder how exactly do they "disable" the back button functionality? I can long press the back button to view a long list of the same exact link (this is a screenshot on Imgur), and eventually the search page is listed at the bottom (omitted for my privacy).
How do websites pull this back button hijacking off? And why does it not appear on actual search history? Is there any way to recognize this happening in the browser backend?