Trusted answers to developer questions

How to redirect to a webpage using JavaScript

Get Started With Data Science

Learn the fundamentals of Data Science with this free course. Future-proof your career by adding Data Science skills to your toolkit — or prepare to land a job in AI, Machine Learning, or Data Analysis.

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

RELATED TAGS

javascript
Copyright ©2024 Educative, Inc. All rights reserved
Did you find this helpful?