title: Chrome send data from background page to browser action
body: <p>So I have a background page that listens in on tab changes</p>
  
  <pre><code>var tabHandler={
  
  
      onTabUpdate:function(tabId,  changeInfo,  tab){
  
  
      },
      tabChanged:function(activeInfo) {
          function tabChanged(tab){
  
          var parser = document.createElement('a');//To extract the hostname, we create dom element 
          parser.href = tab.url;
  
          var regex=/^(www\.)?([^\.]+)/
          var matches=regex.exec(parser.hostname)//This gives us the hostname, we extract the website name
          var website=matches[2];
          var data=getDataForWebsite(website);//Data is a json array
              //TRANSFER 'data' to Browser popup so that it can be displayed.
          }
  
          chrome.tabs.get(activeInfo.tabId,tabChanged);
      },
  
      init:function(){
          chrome.tabs.onActivated.addListener(this.tabChanged);
  
      }
  
  
  
  }
  
  tabHandler.init();
  </code></pre>
  
  <p>This piece of code  gets the nam of the website and fetches a list of parameters based on the website. Now that I have the data, I am wondering how to show this data in the browser action popup. I want to pass this data to the browser Action adn then parse it there to replace existing content. How do I do that?</p>