title: How to get the current tab's referrer from a Chrome extension?
body: <p>From my chrome extension, I am trying to get the referrer link when a user
  navigates to Amazon.com from another website but I am running into some issues.</p>
  
  <p>I am using  <a href="https://stackoverflow.com/questions/7697001/accessing-the-current-">accessing the current html page from chrome extension</a>
  html-page-from-chrome-extension?noredirect=1&amp;lq=1 and
  <a href="https://stackoverflow.com/questions/1964225/accessing-current-tab-dom-object-">Accessing Current Tab DOM Object from &quot;popup.html&quot;?</a>
  from-popup-html but still have issues.</p>
  
  <p>My js in confirmation.js:</p>
  
  <pre><code>chrome.tabs.onUpdated.addListener( function (tabId, changeInfo, tab) {
    if (changeInfo.status == 'loading') {
  
            console.log(tab);
  
            console.log(document);
            //console.log(document.referrer);
  
  
    }
  });
  </code></pre>
  
  <p>Currently, when this outputs the DOM of popup.html; not the current DOM of the tab the user is on. How do I get the document of the current tab the user is on?</p>
  
  <p>Console.log(tab) provides the information for the current tab the user is on but I do not see any referrer attribute here.</p>
  
  <p>Any advice on how I should solve this?</p>
  
  <p>My manifest.json:</p>
  
  <pre><code>"permissions": [
      "activeTab",
      "tabs",
      "storage",
      "notifications"
  ],
  "content_scripts": [
  {
  "matches": ["https://www.amazon.com/*"],
      "js": ["confirmation.js"]
  }
  ]
  </code></pre>