Sometimes, we want to open new page in same window with JavaScript.
In this article, we’ll look at how to open new page in same window with JavaScript.
How to open new page in same window with JavaScript?
To open new page in same window with JavaScript, we call the window.open
method.
For instance, we write
window.open("http://example.com", "_self", false);
to call window.open
with the URL we want to open and '_self'
to open the new page in the same window.
Conclusion
To open new page in same window with JavaScript, we call the window.open
method.