The browser’s back button allows redirecting back to the previous page.
Sometimes we need to restrict the user from going back to the previous page for security. So we can easily restrict users to back the previous page using JavaScript. You need to add the following code to the head section.