title: Chrome Extension Send Message From Background.js to Content Script
body: <p>I have read the documentation on how to do <strong>Send Message From background javascript file(main.js) to Content Script (content.js)</strong> but I cannot get the onMessage to open my alert.</p>
  
  <p><strong>Manifest.json</strong></p>
  
  <pre><code>{
     "name": "Example",
     "version": "1.0.1",
     "manifest_version" : 2,
     "description": "Example Description",
     "background" : {
       "scripts" : ["main.js"]
     },
     "page_action" : {
        "default_icon": {
           "19": "icons/19.png",
           "38": "icons/38.png"
        },
        "default_title" : "Example Title"
     },
     "content_scripts": [{
        "matches": ["&lt;all_urls&gt;"],
        "js": ["lib/jquery-1.8.3.min.js","scripts/content.js"],
        "run_at": "document_idle",
        "all_frames": false
     }],
     "permissions": [
         "tabs",
         "geolocation"
     ],
     "icons": {
         "16": "icons/16.png",
         "48": "icons/48.png",
         "128": "icons/48.png"
     }
  
  }
  </code></pre>
  
  <p><strong>Background javascript file (main.js)</strong></p>
  
  <pre><code>chrome.tabs.query({active: true, currentWindow: true}, function(tabs){
      chrome.tabs.sendMessage(tabs[0].id, {action: "SendIt"}, function(response) {});  
  });
  </code></pre>
  
  <p><strong>Content javascript file (content.js)</strong></p>
  
  <pre><code>chrome.extension.onMessage.addListener(function(msg, sender, sendResponse) {
     if (msg.action == 'SendIt') {
        alert("Message recieved!");
     }
  });
  </code></pre>