How to disable browser back button using Jquery?
In this post we will give you information about How to disable browser back button using Jquery?. Hear we will give you detail about How to disable browser back button using Jquery?And how to use it also give you demo for it if it is necessary.
How can we disable browser forward and back button using jquery or javascript that is lead topic. we can use window.history.pushState for restrict back button of browser in jquery. we can disable back button in browser using jquery in php or any mvc framework like laravel, codeigniter etc.
Sometime we need to restrict back button function in your browser because of security. so no one can access that page with back button.
I will give you simple example to disable browser back button in js, so you can run js code in your local system and see it. Just see bellow example:
Example:
<!DOCTYPE html>
<html>
<head>
<title>How to disable browser back button using Jquery? - ItSolutionStuff.com</title>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
</head>
<body>
<button>click on browser back button</button>
</body>
<script type="text/javascript">
$(document).ready(function() {
window.history.pushState(null, "", window.location.href);
window.onpopstate = function() {
window.history.pushState(null, "", window.location.href);
};
});
</script>
</html>
I hope it can help you….
Hope this code and post will helped you for implement How to disable browser back button using Jquery?. if you need any help or any feedback give it in comment section or you have good idea about this post you can give it comment section. Your comment will help us for help you more and improve us. we will give you this type of more interesting post in featured also so, For more interesting post and code Keep reading our blogs