title: Chrome Extension - Message Passing from Popup to Content Script
body: <p>I'm trying to pass data from a popup to a content script, but I'm not having any luck. I got it to work the other way around (content -> popup) though. All I want to do is enter text into an input located in the popup and click a submit button which would insert that text into the dom of a web page.</p>
  
  <p>This is what I have:</p>
  
  <p>popup.html</p>
  
  <pre><code>chrome.extension.sendRequest({action:'start'}, function(response) {
      console.log('Start action sent');  
  });
  </code></pre>
  
  <p>contentscript.js</p>
  
  <pre><code>function startExtension() { console.log('Starting Extension'); }
  
  function stopExtension() { console.log('Stopping Extension'); }
  
  function onRequest(request, sender, sendResponse) {
      if (request.action == 'start')
          startExtension()
      else if (request.action == 'stop')
          stopExtension()
      sendResponse({});
  }
  
  chrome.extension.onRequest.addListener(onRequest);
  </code></pre>