title: Close a Chrome extension popup by clicking the browser action icon again
body: <p>I'm developing a Chrome extension and I wanted to know if it is possible to close a popup by simply clicking again the icon that lets you open the popup: I tried anything but it looks like you must click elsewhere to close it. The docs states the <code>onClicked</code> event is:</p>
  
  <p><em>Fired when a browser action icon is clicked. This event will not fire if the browser action has a popup</em> (<a href="http://developer.chrome.com/extensions/browserAction.html#popups">http://developer.chrome.com/extensions/browserAction.html#popups</a>).</p>
  
  <p>Thanks in advance.</p>
  
  <p><strong>[UPDATE]</strong> I tried the following and it half (!) works:
  1. in popup.html I link popup.js;
  2. popup.js reads the value of a variable contained in background.js;</p>
  
  <pre><code>var currentStatus = chrome.extension.getBackgroundPage().open;
  if(currentStatus==0){
    chrome.extension.getBackgroundPage().open=1;
  }else{
    chrome.extension.getBackgroundPage().open=0;
    window.close();
  }
  </code></pre>
  
  <p>What happens: the first click opens the app, the second closes it, BUT it remains a micro popup with no content upon the icon. If I remove that, I reached my goal.</p>