Open a URL in a New Tab Using JavaScript

HTML have an attribute option to open URL in a new tab.

The target attribute basically decide where to open linked anchor.In this tutorial, we will see how to open a URL in new tab using JavaScript.

Window.open function is used to open linked document in new tab. In this function, second param is optional which allow to add attribute.

window.open("http://www.phpcluster.com","_blank"); 

Pass URL in first param and attribute in second param to open URL in new tab or window using  JavaScript.

Recommended Tutorials For You

Amount Field Validation Using JavaScript

How To Redirect If JavaScript Is Disabled In A Browser

Leave a Comment