How to redirect to a webpage using JavaScript

There are two ways to redirect to a webpage using JavaScript. In the following examples, the user will be redirected to the jQuery webpage once they click the button:

1. Using location.replace()

2. Using location.href

Free Resources

Copyright ©2024 Educative, Inc. All rights reserved