JavaScript Open url in new tab

This quick JavaScript tutorial help to open a linked url in new browser window or tab.The html is anchor '<a>' tag that ll use for open a url into the new tab using JavaScript.

HTML a target attribute provides a easy way to open a URL into the new browser window or tab.We ll use _blank value in target attribute to open the linked URL in a new tab or window.

Above code ll open phpflow.com into tab using pure html.

But If you want to open URL with JavaScript. The JavaScript window.open() method is used to opens a new browser window depending on the browser setting and the parameter values. We can pass _blank as the second parameter into the window.open() method to open a URL in a new tab using JavaScript.

The following JavaScript code will open https://www.phpflow.com in a new browser tab or window.

Full Source Code:

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.