I am trying to access an object HelpObject
which is only defined in certain web pages. However, when I try to access the object through the background script, executing the query on a specific tab this way –
<code>chrome.scripting.executeScript({
target: { tabId: tabIdVal, allFrames: true },
func: execFunc, // Pass execFunc as a function
});
const execFunc = () => {
console.log(HelpObject.getContext());
};
</code>
<code>chrome.scripting.executeScript({
target: { tabId: tabIdVal, allFrames: true },
func: execFunc, // Pass execFunc as a function
});
const execFunc = () => {
console.log(HelpObject.getContext());
};
</code>
chrome.scripting.executeScript({
target: { tabId: tabIdVal, allFrames: true },
func: execFunc, // Pass execFunc as a function
});
const execFunc = () => {
console.log(HelpObject.getContext());
};
I get an error in the corresponding tab console, which says that HelpObject is not defined
. If I go to the console of the same tab and type in the same command, it works perfectly fine.
Is it something with respect to the scope? Or is there something wrong with how I am trying to access it?