title: onkeydown not working on new window with url
body: <p>In my React application, I am opening a new window on click of a button. This window is being stored in a variable and I have attached functions for <code>onkeydown</code> and <code>onbeforeunload</code> events.</p>
  <p>I have observed that these functions are being called only when the url of the window is empty.</p>
  <pre><code>window.open('', '', '')
  </code></pre>
  <p>For non-empty urls, these events are not being triggered.</p>
  <pre><code>window.open('https://wwww.stackoverflow.com', '', '')
  </code></pre>
  <p>Here is a codesandbox demonstrating this:</p>
  <p><a href="https://codesandbox.io/s/upbeat-sanderson-bv83q?fontsize=14&amp;hidenavigation=1&amp;theme=dark" rel="nofollow noreferrer"><img src="https://codesandbox.io/static/img/play-codesandbox.svg" alt="Edit upbeat-sanderson-bv83q" /></a></p>
  <p>Has this got anything to do with the url itself? Please specify if I am missing anything here...</p>
  <hr />
  <p><strong>ACTUAL USE CASE:</strong></p>
  <p>In my frontend application (which runs on port 3000), I am trying to open a new window which opens the backend URL (which runs on port 8000). So, on a button click in <strong>http://localhost:3000</strong>, a new window will be opened which points to <strong>http://localhost:8000/api/something</strong>.</p>
  <p>So, I added nginx as a reverse proxy and point '/' to 3000 and '/api' to 8000 and access both of these under port 80 as follows:</p>
  <pre><code>http {
      upstream backend {
          server 127.0.0.1:8000;
      }
  
      upstream frontend {
          server 127.0.0.1:3000;
      }
  
      server {
          listen 80;
  
          location /api {
              proxy_pass http://backend;
          }
      
          location / {
              proxy_pass http://frontend;
          }
      }
  }
  </code></pre>
  <p>So, now I am able to access the ui application by going to <strong>http://localhost</strong> and on the button click, the new window will open <strong>http://localhost/api/something</strong>. Shouldn't this overcome the same origin issue?</p>