title: How to reload current tab from within a chrome extension popup.html?
body: <p>I am trying to click on a button to refresh the current page from within a chrome extension.</p>
  
  <p>(NOTE: The reason is because I loaded a script and I needed the page to refresh because presently I just have a disclaimer"you need to refresh the page for it to work", but I would like to remove this disclaimer and just have it done automatically).</p>
  
  <p>I can't figure it out. Here is my code I am trying to refresh the page. If you know a way to eliminate this code and just use an onclick that would be great too, but I tried <code>onclick="location.reload();"</code> but it doesn't work because it isn't fetching the actual tab but just the popup page.</p>
  
  <p><strong><em>background.html</em></strong></p>
  
  <pre><code>chrome.browserAction.onClicked.addListener(function (activeTab) {
      var newURL = toggleDevMode(activeTab.url);
      chrome.tabs.update({
          url: refresh
      });
  });
  </code></pre>
  
  <p><strong><em>refresh.js</em></strong></p>
  
  <pre><code>document.getElementById("mydivtoclicky").onclick = function() {
      chrome.tabs.getSelected(null, function(tab) {
          tabId = tab.id;
  
          // send a request to the background page to store a new tabId
          chrome.runtime.sendMessage({type:"new tabid", tabid:tabId});
      });
  };
  
  chrome.runtime.sendMessage({type:"refresh"});
  </code></pre>
  
  <p><strong><em>popup.html</em></strong></p>
  
  <pre><code>&lt;head&gt;
      &lt;script type="text/javascript" src="../refresh.js"&gt;&lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
      &lt;div id="mydivtoclicky"&gt;REFRESH PAGE&lt;/div&gt;
  &lt;/body&gt;
  </code></pre>
  
  <p>Please help thanks.</p>