title: Chrome.tabs.executeScript callback function usage
body: <p>I am reading <a href="http://developer.chrome.com/extensions/tabs.html" rel="nofollow noreferrer">Chrome.tabs.executeScript</a> and do not known how to use the callback function of executeScript.</p>
  
  <p>for example i have </p>
  
  <pre>
  function button(){
          chrome.browserAction.onClicked.addListener(function(tab) {          
              chrome.tabs.executeScript(tab.id, {file: "content_script.js", allFrames: true}, function(results){
                  for(var index in results){
                      console.log(results[index]);
                  }
              });
          });
      }
  </pre>
  
  <p>According to that page "result ( optional array of any ) The result of the script in every injected frame." </p>
  
  <p><b>Is this mean the callback is fired when content_script.js had executed in all injected page and frames? And How can I return a result from my content_script.js?</b></p>
  
  <p>Thanks.</p>
  
  <p><b>Answer:</b>
  Find the answer at <a href="https://stackoverflow.com/questions/13166293/about-chrome-tabs-executescript-id-details-callback?rq=1">here</a>, "The result of a script is the last expression being evaluated."</p>