window.location property to make a page redirect, you don't need any jQuery for this. If you want to redirect the user from one page to another automatically, you can use the syntax
The benefit here is, the
replace() method does not save the originating page in the session history, meaning the user won't be able to use the browser back button to navigate to it, which prevents the user from getting redirected to the destination page once again.
Create a blank HTML file and put the following example code inside it. Now open this file in a web browser, you will be automatically redirected to the home page of this website after 10 seconds. If you notice carefully you will find that the browser back button is still disabled.
However, if you want to redirect the page when an event occurs, such as when the user click on a button element, you can just use the
window.location.href = "page_url", which produce the similar effect when someone click a link to navigates to other page.
Similarly, create another HTML file and put the following example code inside it. Now open the file in a web browser and click the button on the page, it will redirect you to the home page of this site. Also, at this time you can see the browser back button becomes active.
How to Convert a Date from yyyy-mm-dd to dd-mm-yyyy Format in PHPUse the strtotime() Function You can...
How to Get the Current Year using PHPUse the PHP date() Function You can s...
How to Strip All Spaces Out of a String in PHPUse the PHP str_replace() Function Yo...