0

I have that function :

const test =  () => {
    var url = "https://www.google.fr";
    window.location.href = url;
    }

But I would like to open Google in a new tab. How can I do to do that ?

Thank you very much !

  • 3
    Does this answer your question? [JavaScript: location.href to open in new window/tab?](https://stackoverflow.com/questions/5141910/javascript-location-href-to-open-in-new-window-tab) – zhulien Oct 22 '21 at 12:01

1 Answers1

4

Try this one:

window.open(URL, '_blank');