title: Pop-Up Window, Center Screen
body: <p>I'm using the following code to open a pop-up window in a Google Chrome extension, my one question is, how do I get the pop-up window to open in the centre of the users screen?</p>
  
  <pre><code> &lt;script&gt;
    chrome.browserAction.onClicked.addListener(function() {
      var left = (screen.width/2)-(w/2);
      var top = (screen.height/2)-(h/2); 
    chrome.windows.create({'url': 'redirect.html', 'type': 'popup', 'width': 440, 'height': 220, 'left': '+left+', 'top': '+top+', } , function(window) {
     });
  });
    &lt;/script&gt;
  </code></pre>
  
  <p>I've also tried this, which resulted in no such luck.</p>
  
  <pre><code>  &lt;script&gt;
    chrome.browserAction.onClicked.addListener(function() {
    chrome.windows.create({'url': 'redirect.html', 'type': 'popup', 'width': 440, 'height': 220, 'left': (screen.width/2)-(w/2), 'top': (screen.height/2)-(h/2), } , function(window) {
     });
  });
    &lt;/script&gt;
  </code></pre>