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

281 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

It’s obviously a security flaw when sites do that but normally it’s done to maliciously trap you in an unsafe site or advertisement hell; or to avoid issues with repeating certain tasks. If a website goes from state A to B after an operation, but causes errors if you repeat the operation, a (poor) workaround is to prevent the navigation to the page where you performed the operation. Of course it isn’t flawless, specially if you can just retype the url on the search bar.
How they do it, normally you can manipulate the history by adding a blank or redirection page so that you never land where you were before

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