title: How to open second window on button click in electron
body: <p>I have a button in my index.html that I would like to open a second window when clicked.</p>
  
  <p>I have added the following to my index.js:</p>
  
  <pre><code>const button = document.getElementById('newtask');
  button.addEventListener('click', () =&gt; {
    newtaskwindow();
  });
  
  function newtaskwindow() {
    const BrowserWindow = remote.BrowserWindow;
    const win = new BrowserWindow({
      height: 400,
      width: 600
    });
  
    win.loadURL('createtasks.html');
  }
  </code></pre>
  
  <p>On npm start, I'm getting the following error: 
  <a href="https://i.stack.imgur.com/Rjc3H.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Rjc3H.png" alt="enter image description here"></a></p>