title: Chrome extension: Cannot run code in chrome.tabs.executeScript in context of the page
body: <p>I created an extension for Google Chrome with this background script <code>background.js</code>:</p>
  
  <pre><code>chrome.browserAction.onClicked.addListener(function(tab) {
    chrome.tabs.executeScript(tab.id, {code:"document.body.style.background='red !important';"}); // doesn't work
    chrome.tabs.executeScript(tab.id, {code:"alert('hello');"}); // runs alert
  });
  </code></pre>
  
  <p>I want to run <code>document.body.style.background='red !important';</code> in the context of the web page.<br>
  How can I do it?</p>
  
  <p><code>manifest.json</code>:</p>
  
  <pre><code>{
    "name": "Test",
    "version": "1.0",
    "manifest_version": 2,
    "description": "Test",
    "browser_action": { "default_icon": "icon.png" },
    "background": { "scripts": ["background.js"] },
    "permissions": ["tabs", "*://*/*"]
  }
  </code></pre>