I am going to show you example of how can you disable browser forward and back button using jquery. In this article, we will implement a disable back button in browser using jquery in php. We will use jquery disable back button of browser. you will learn disable back button in browser using jquery example. Here, Creating a basic example of how can you disable browser forward and back button using jquery.
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? - HDTuto.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....
Do you like below Tutorials ?
- How to Open URL in New Tab using Jquery?
- Laravel 7.x and 6.x Routing Tutorial
- Ng Bootstrap Modal in Angular 8 Example
- Bootstrap 4 Datepicker in Angular 9/8 Example
- Disable Registration Route in Laravel
- Bootstrap Timepicker in Angular Example
- Count Number of Pages in PDF - PHP Script
- Digital Signature PHP Script Example