var stuff = "Heeeey";
chrome.extension.getBackgroundPage().chrome.tabs.executeScript(null, {
file: 'sendMessage.js'
});;
How can I pass the variable stuff
to the file, sendMessage.js
?
var stuff = "Heeeey";
chrome.extension.getBackgroundPage().chrome.tabs.executeScript(null, {
file: 'sendMessage.js'
});;
How can I pass the variable stuff
to the file, sendMessage.js
?
There is no way to pass a variable into the executed script. This is done I guess for security and performance reasons because this may introduce memory leaks.
What you can do is passing a value of the variable.
There are two ways:
executeScript
but passing the script as a string instead of the file name. You can do executeScript
calls: one for value injections and another for file injection.