Sometimes, we want to add target="_blank" to JavaScript window.location with JavaScript.
In this article, we’ll look at how to add target="_blank" to JavaScript window.location with JavaScript.
How to add target="_blank" to JavaScript window.location with JavaScript?
To add target="_blank" to JavaScript window.location with JavaScript, we call window.open
with '_blank'
.
For instance, we write
window.open("http://www.example.com", "_blank");
to call window.open
with the URL we want to open and '_blank'
to open the URL in a new tab or window.
Conclusion
To add target="_blank" to JavaScript window.location with JavaScript, we call window.open
with '_blank'
.