Disable back button only if about to leave the site?


Hi folks is there a way I can disable back button only if user is about to leave the site?

If they hit back button that will land them on some page of the same site then don’t disable back button.

Only if they land on the page and then decide to hit button that will take em away from the site only then disable or maybe even redirect em to some other page of the same site.



Users expect their browser to work in a given way. Interfering with that by disabling the back button - or, worse, by causing an unexpected redirect - is likely to confuse and/or annoy your visitors.

Perhaps if you explain the use case, somebody could suggest a better solution.


I have noticed one of my competitors got this back button disabled and in no time they hit the first page it makes me believe it could be case this way they achieve low bounce rate.


Not really. It would just mean forcing people to close their browser tab rather than hitting the back button, and at the same time annoying your users because people DONT want to be caged in to a single site.


Do you think Google got a way to figure out whether the site is using this technique or not?


Bounce rate alone does not indicate anything.

You might have a high bounce rate because people find exactly what they want on the first page they land on and go away happy. Your competitor may have a low bounce rate because he tries to trick people into staying on his site, and as a result probably has a lot of unhappy visitors.

If you want to impress Google, work on creating great content and forget about silly tricks.


I feel you man. Thanks for this aye opening reply makes a lot of sense to me.



Not likely, because they dont have access to that sort of information - a bounce, by google’s terms, is any session to your website that generates a single hit to the analytics server. You can have a 0 bounce rate by having an index page that sends a request to the analytics server, then redirects the user to the ‘real’ index page, which also generates a hit to the analytics server. It doesn’t DO anything for you except artificially reduce a number on your stats page.

You’re not supposed to “win” analytics. It’s not a contest. They’re tools to help you find out what people are doing on your site.


please don’t disable back buttons. It drives me mental when i have to fight to get back to my google search etc. If i can’t back button i just close the tab and try and remember never to go back to that website.

slightly less annoying is the pop up message that is fired if you go near certain elements on the page that says ‘Don’t go here is some offer or other’ … I wasn’t leaving i was simply moving my cursor on my screen… now i am leaving!


I completely aggree. I would be very annoyed when I am forced to stay on a certain website


I’m laughing only because after NOT wanting to leave a site, I’m back at my search page. I’m laughing because I would like a warning to let me know I might leave the page.

After so many [expletives deleted] I no longer click on links on the page I’m on. In my pages, any link is opened in a separate tab. Why would I want people to be pulled away from my site?

There have been thousands of times I click a link, especially in tutorials, and I get pulled away, click the back button, just to land at the top of the page.

You guys talk about not getting away from the page and I want to stay. Now I give up. Anytime I need a link I’ll just right-click > open in new tab. Unless it’s an internet search. Then I’ll highlight the page I’m going to visit, then right-click.


And that’s exactly as it should be. You choose how you want links to open and how you want the browser to behave. It is not being dictated to you by the site.