Categories
JavaScript Answers

How to go from one page to another page using JavaScript?

Spread the love

Sometimes, we want to go from one page to another page using JavaScript.

In this article, we’ll look at how to go from one page to another page using JavaScript.

How to go from one page to another page using JavaScript?

To go from one page to another page using JavaScript, we set the window.location.href property to the string with the URL we want to navigate to.

For instance, we write

window.location.href = "sample.html";

to set window.location.href to "sample.html" to navigate to sample.html.

Conclusion

To go from one page to another page using JavaScript, we set the window.location.href property to the string with the URL we want to navigate to.

Leave a Reply

Your email address will not be published.

If you like the content of this blog, subscribe to my email list to get exclusive articles not available to anyone else.