How to change pages using jQuery

Asked 2 years ago, Updated 2 years ago, 40 views

How can I change the page to another page using jQuery?

javascript jquery

2022-09-21 21:14

1 Answers

jQuery is not required. Use window.location.replace(...) to make it simple. This is better than using window.location.href. Because replace() does not put the original page in the session history, it does not fall into an infinite orbit when the user presses Back. However, if you want to connect by clicking on the link, you should use location.href. If you want to replace an existing page with a new page, you can use location.replace.

// HTTP redirect 
window.location.replace("http://stackoverflow.com");

// Link connection
window.location.href = "http://stackoverflow.com";


2022-09-21 21:14

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.