Gatik Garg
Gatik Garg

Reputation: 1

Opening Webpages in new tab using JavaScript

We Know That we can redirect to web pages using location.href or location.replace but I wanted to ask that can We open a new webpage in a new tab using JavaScript.

Upvotes: 0

Views: 47

Answers (2)

Rain.To
Rain.To

Reputation: 512

Try

window.open(url, '_blank')

where url is the link you want to open

Upvotes: 3

Sahandevs
Sahandevs

Reputation: 1160

You can do it using window.open(url)

for more details: https://developer.mozilla.org/en-US/docs/Web/API/Window/open

Upvotes: 0

Related Questions