If you are looking to disable the “Go Back” button when visitors are on your website or a web page you own, either for limiting the visitor’s movement or simply reduce the bounce rate on your website, you can use the following code.
Simply include this on any webpage you want the “go back” diasbled
1
2
3
4
5
6
<script type="text/javascript">
history.pushState(null,null,document.URL);
window.addEventListener('popstate', function () {
history.pushState(null,null,document.URL);
});
</script>
This of course is an idea for its use, but please note that there may be instances where it will affect the visitor’s experience.