javascript - How do I pass parameter to a `chrome.tabs.executeScript` in a chrome extension? -


when i'm getting message popup want execute script, simply:

chrome.runtime.onmessage.addlistener(function(message, sender, response) {        chrome.tabs.executescript({file: "content.js"}); }); 

my problem: content.js needs data message. how pass it?

try

chrome.runtime.onmessage.addlistener(function(message, sender, response) {     chrome.tabs.executescript({code: paramname=paramvalue},function() {         chrome.tabs.executescript({file: "content.js"});     }); }); 

they both injected same isolated world, content.js can refer same variables.


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -