title: Fetch current URL and save it with a chrome extension
body: <p>I am trying to make a chrome button that allows a user to save their current URL. Later I will want to send that url to a website's database when they log back in, but that is beyond my current task. </p>
  
  <p>The functionality that I want can be summed up in this image: </p>
  
  <p><a href="https://i.stack.imgur.com/5e6nL.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/5e6nL.png" alt="screenshot"></a></p>
  
  <p>I found this question asked at the URL below, but the rules for chrome extensions have changed and that code no longer works. <a href="https://stackoverflow.com/questions/2797853/get-url-and-save-it-chrome-extension">Get URL and save it | Chrome Extension</a></p>
  
  <p>One comment says:
  "As of manifest_version 2, the above code will not work. All Scripts should be placed in a separate file &amp; then include it on the main html. New version clearly states that Inline scripts and event handlers disallowed. "</p>
  
  <p>I couldn't figure out how to implement what this person suggested.</p>
  
  <p>What I have so far:</p>
  
  <p>popup.hmtl</p>
  
  <pre><code>&lt;html&gt;
  &lt;body&gt;
  &lt;p id="currentLink"&gt;Loading ...&lt;/p&gt;
  &lt;hr /&gt;
  &lt;ul id="savedLinks"&gt;&lt;/ul&gt;
  &lt;script type="text/javascript" src="popup.js"&gt;&lt;/script&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>popup.js </p>
  
  <pre><code>chrome.tabs.query({'active': true}, function (tabs) {
      var url = tabs[0].url;
  });
  </code></pre>
  
  <p>manifest:</p>
  
  <pre><code>{
    "name": "URL Saver",
    "version": "1.1",
    "description": "A browser action that saves the url of the current open tab",
    "permissions": [
      "tabs"
    ],
    "browser_action": {
        "default_title": "URL CATCHER",
        "default_icon": "icon.png",
        "default_popup": "popup.html"
    },
    "manifest_version": 2,
    "content_security_policy": "script-src 'self' https://ajax.googleapis.com; object-src 'self'"
  }
  </code></pre>
  
  <p>Now, if I click the button, I just get a "Loading ... _______" message</p>