In this tutorial, We will explain to you how to open a URL in a new tab using javascript. it is possible to open a URL in a new tab using Window open() Method in javascript.
so you can follow the below example.
<html> <head> <title></title> <script> function openInNewTab(url) { var win = window.open(url, '_blank'); win.focus(); } </script> </head> <body> <button onclick="openInNewTab('www.xpertphp.com');">Open XpertPhp</button> </body> </html>
Please follow and like us: