title: Have chrome.tabs.reload() reload a tab other than the active tab
body: <p>As my first extension, I am trying to use <code>chrome.webRequest</code> API to reload webpages which, when it is not available, the web server redirects the request to another URL. My extension will keep on trying the original request (<code>tabs.reload</code>) if redirect is found (<code>onBeforeRedirect</code> event occurs).</p>
  
  <p>Everything works fine, except that I can not make it run on multiple tabs. The extension can create one tab and keep on reloading, but when I click the extension icon to open another tab or when I click on other inactive tabs, <em>background.js</em> stops running.</p>
  
  <p>How can I modify it to run on multiple tabs (for example, 5 tabs concurrently) without stopping?</p>
  
  <p>Here is <strong>background.js</strong>:
  </p>
  
  <pre><code>chrome.browserAction.onClicked.addListener(function(activeTab) {
     var newURL = "https://myurl";
     chrome.tabs.create({ url: newURL });
  });
  
  chrome.webRequest.onBeforeRedirect.addListener(function (details) {
      console.log("Redirect -&gt; Reload");
      chrome.tabs.reload();
  }, {
      urls: ["http://*/*", "https://*/*"]
  }, ["responseHeaders"]);
  
  chrome.webRequest.onResponseStarted.addListener(function (details) {
      console.log("Response Started");
      console.log(details.url); 
      console.log(details.statusLine);
      if (details.url === "https://myurl" &amp;&amp; details.statusCode === 200 ) {
          console.log("Finally");
      }
  }, {
      urls: ["http://*/*", "https://*/*"]
  }, ["responseHeaders"]);
  </code></pre>
  
  <p><strong>manifest.json</strong>:</p>
  
  <pre class="lang-json prettyprint-override"><code> {
    "name": "My Tool",
    "description": "My Tool",
    "version": "1",
    "manifest_version": 2,
  
    "browser_action": {
      "default_icon": "icon.png"
    },
    "background": {
      "scripts": ["background.js"]
  },
    "permissions":[
      "https://myurl",
      "http://redirectedurl",
      "webRequest",
      "webRequestBlocking",
      "tabs"
    ]
  }
  </code></pre>