+ Start a Discussion
Tobias HaggeTobias Hagge 

Custom Button onclick javascript to open link in new browser tab

Thought this should be relative straight forward, but standard functionality does not provide this.

So I thought to execute onclick Javascript instead.

window.open("https://www.google.com/");

Something like this. Any adjustments to get this working?

Thanks in advance.
Best Answer chosen by Tobias Hagge
Bhawani SharmaBhawani Sharma
This looks correct. Isn't it working?
See here:
http://www.w3schools.com/jsref/tryit.asp?filename=tryjsref_win_open

All Answers

Bhawani SharmaBhawani Sharma
This looks correct. Isn't it working?
See here:
http://www.w3schools.com/jsref/tryit.asp?filename=tryjsref_win_open
This was selected as the best answer
Tobias HaggeTobias Hagge
Ah yeah it works now. Whitelisting the URL helps!
David Roberts 4David Roberts 4
Many thanks for this.
I'd been using
window.location.href = "https://www.google.com/"
which showed the page in the currect tab rather than a new tab.