Sometimes, we want to simulate target="_blank" in JavaScript.
In this article, we’ll look at how to simulate target="_blank" in JavaScript.
How to simulate target="_blank" in JavaScript?
To simulate target="_blank" in JavaScript, we call the window.open
method.
For instance, we write
window.open("http://www.example.com", "_blank");
to call window.open
to open http://www.example.com.
We call it with '_blank'
to show the page in a new window.
Conclusion
To simulate target="_blank" in JavaScript, we call the window.open
method.