Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Web Technology by (47.6k points)

I'm trying to open a URL in a new tab, as opposed to a popup window.

I've seen related questions where the responses would look something like:

window.open(url,'_blank'); 

window.open(url);

But none of them worked for me, the browser still tried to open a popup window.

1 Answer

0 votes
by (106k points)

To open a URL in a new tab using JavaScript you can use the following method:-

function openInNewTab(url) { 

var win = window.open(url, '_blank');

win.focus();

}

Related questions

0 votes
1 answer
0 votes
1 answer
asked Feb 16, 2021 in Java by dante07 (13.1k points)
0 votes
1 answer
asked Mar 31, 2021 in Java by dante07 (13.1k points)
0 votes
1 answer
0 votes
1 answer

Browse Categories

...