I want to open google and youtube in one click. But the tricky part here is, I want it to be open in a new window. I already achieved it on tab. But my client don't want to open in tab. So I need to change it on new window.
Here's what I've tried so far.
<a href="#" id="linkTrigger">Open Links</a>
var trigger = document.getElementById('linkTrigger'),
link = ['www.google.com', 'www.youtube.com'];
trigger.onclick = function {
[].forEach.call(link, function(e){
if(e == 'www.google.com')
window.open(e, 'newwindow', 'height: 100px, width: 100px');
else
window.open(e);
});
}
I also read that window.open(/* link */, _blank) should open in a new window, However, for me. It's opening in new tab. I'm currently using Google Chrome 49.
The script can just open google as we expected.
I searched for possible solutions but there's no the same problem with me.
Any help would be appreciated. Thanks!