I am reading Chrome.tabs.executeScript and do not known how to use the callback function of executeScript.
for example i have
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]); } }); }); }
According to that page "result ( optional array of any ) The result of the script in every injected frame."
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?
Thanks.
Answer: Find the answer at here, "The result of a script is the last expression being evaluated."