how do some websites prevent you from using the ‘back’ button to leave the page?

279 views

Often when I’m googling something I’ll go to a few pages, so I’ll click a link, and then use the back button to return to the search results and find another link. But sometimes the back button just reloads the page, and even tapping it multiple times doesn’t work. How and why do some websites do this? Surely it should be my browser that’s controlling if it goes back or not, rather than the website it’s on?

In: 197

11 Answers

Anonymous 0 Comments

There are two or three methods most of them are cracked down by browser developers but some are still possible:

1. Quick redirect – You go to page A that quickly redirects you to page B. If you go back you end up on page A which in turn quickly sends you to page B. Quickly tapping back twice (or right click and choose one you want to go back to) can defeat this.
2. Using javascript – there s a browser API that allows your action on page to change history without reloading the page. That’s how some “webapps” can work. But malicious website can push a lot of “state” onto the history. This one is harder to defeat and usually you need to close the tab.

You are viewing 1 out of 11 answers, click here to view all answers.