title: Get current page URL in Chrome extension
body: <p>I want to get the current page URL from my <code>default_popup</code> page like this:</p>
  
  <pre class="lang-js prettyprint-override"><code>chrome.tabs.query({active:true},function(tab){
      url = tab.url;
  });
  </code></pre>
  
  <p>And I have registered this <code>popup.html</code> page in the <code>manifest.json</code> file. Yet
  I am getting the error message:</p>
  
  <blockquote>
    <p>Uncaught Type Error: Cannot call method 'query' of undefined</p>
  </blockquote>
  
  <p>What am I doing wrong?</p>