I want to pass a variable as text or somehow to make above function to work:
var title = "Hello World";
chrome.tabs.executeScript(tabId, {code: "var param1='"+title+"'; var param2='value2'; "}, function(){ /*some code*/ });
When I execute above function it not pass title
to param1
, it must define param1
as title
. Because title
is dynamic, it can be diffrent, so I really need to know how can pass my title variable.
If I change code like this :
chrome.tabs.executeScript(tabId, {code: "var param1='Hello World!'; var param2='value2'; "}, function(){ /*some code*/ });
than it works perfect