Introduction
In JavaScript, we may need to redirect to another webpage.
In this post, we'll look at how to redirect to another website in JavaScript.
How to redirect to another webpage in JavaScript
To redirect to another webpage using JavaScript we use window.location.replace(...)
method or window.location.href = URL
:
Note that replace()
won't create an entry in your browser's history.
Conclusion
To redirect to another webpage in JavaScript we can use location.replace()
or window.location.href = URL
.
{{ 'Comments (%count%)' | trans {count:count} }}
{{ 'Comments are closed.' | trans }}