title: Chrome Extension - executeScript not in active tab
body: <p>I'm trying a simple Chrome Extension example which should enable me change the background color of any open youtube tabs to red. What I've noticed is that the background of the page is only turned red if I'm on the actual page i.e. it is the active tab.</p>
  
  <p><strong>Code:</strong></p>
  
  <pre><code>function getYouTubeTabs() {
      queryInfo = {
          'url': '*://www.youtube.com/*'
      };
  
      chrome.tabs.query(queryInfo, function (result) {
          for (i = 0; i &lt; result.length; i++) {    
              chrome.tabs.executeScript(result[i].id, {
                  code: 'document.body.style.backgroundColor="red"'
              });
          }
      });
  }
  </code></pre>
  
  <p>This is the code I have, I might be missing something. Not sure if executeScript could be used on 'non-active' tabs. Thanks in advance.</p>
  
  <p><strong>EDIT</strong></p>
  
  <p><em>manifest.json</em></p>
  
  <pre><code>{
    "manifest_version": 2,
  
    "name": "First menu item",
    "description": "Testing Context Menus",
    "version": "1.0",
  
    "permissions": [
      "contextMenus", "tabs", "activeTab"
    ],
    "icons": {
      "16": "myicon.png",
      "128": "myicon2.png"
    },
    "background": {
      "scripts": ["background.js"]
    }
  }
  </code></pre>