xxxxxxxxxx
let your-varible = "test";
//Get the tab ID of the target url
chrome.tabs.query({url: "<Insert Target URL here>/*"}, function(tabs) {
var tabId = tabs[0].id;
console.log(tabId);
chrome.scripting.executeScript({
target: {tabId},
//also dont forget to pass in the varible into the function
func: function(your-varible) {
console.log(your-varible);
},
args: [
your-varible,
//add more varibles here
]
});
});
//you will also need to add this to your manifest.json file
"permissions": [
"tabs",
"activeTab",
"scripting"
],
"host_permissions": [
"<your-url>/*"
]