window.open + set location

Open a new tab, then point it to google

by David Iglesias

HTML

<button id="opener">
Go places!
</button>

JavaScript

let btn = document.querySelector('#opener');

btn.addEventListener('click', () => {
  let win = window.open('about:blank', '_blank');
  setTimeout(() => {
    console.log('Going places!');
    win.location.href = "https://www.google.com";
  }, 500);
});