if (typeof backg !== 'undefined'){
console.log(backg);
}
// It was working fine in MV2
________________________________________________
But the problem is I'm unable to achieve this on MV3
I tried the below method
// background.js
function backgFunc(backg) {
return backg;
}
chrome.scripting.executeScript({
target: { tabId: tabId, allFrames: true },
func: backgFunc,
args: [backg],
}, () => {
chrome.scripting.executeScript({ target: { tabId: tabId }, files: ['execute.js'] });
});
// execute.js
if (typeof backgFunc !== 'undefined'){
console.log(backgFunc());
}
In this case, it's not working. Can anyone help me to figure out this?
[Note: This post was previously posted. The reason I'm unable to paste the full code which is too long and that's why I tried to paste the code in a short and easier but made some mistakes in formatting and writing while I posting. I apologize for the mistake.]