javascript window.location in new tab

Muhammad Imran Tariq picture Muhammad Imran Tariq · Sep 26, 2011 · Viewed 224.6k times · Source

I am diverting user to some url through window.location but this url opens in the same tab in browser. I want it to be open in new tab. Can I do so with window.location? Is there another way to do this action?

Answer

user1450789 picture user1450789 · Dec 3, 2012
window.open('https://support.wwf.org.uk', '_blank');

The second parameter is what makes it open in a new window. Don't forget to read Jakob Nielsen's informative article :)