title: Communication from Popup Page to Content Script Page
body: <p>I am developing an extension and I do not wish to use the options page. I use a browser action (the icon appears on the top-right), and some preferences are made trough that page and I store them in localStorage.</p>
  
  <p>However, my content script needs to read that localStorage but I know that it cannot access it. I looked the message passing but could not accomplish what I would wanted.</p>
  
  <p>Here what I have tried:</p>
  
  <p><strong>popup.js</strong></p>
  
  <pre><code>$(document).ready(function(){
      chrome.extension.onRequest.addListener(function(request, sender, sendResponse) {
          if (request.method == "getList")
              sendResponse({status: localStorage['list']});
          else
              sendResponse({}); // snub them.
          });
  });
  </code></pre>
  
  <p><strong>content.js</strong></p>
  
  <pre><code>$(document).ready(function(){
      var p;
      chrome.extension.sendRequest({method: "getList"}, function(response) {
          p = response.status;
          alert(response.status);
      });
  });
  </code></pre>