I have defined a global object in a .js file. For example file1.js contains the global object SomeObject. This file gets loaded in background.html.
Since file1.js is included in background.html, I am able to access the global object in this page. So no issues here.
When an event like click on the extension button is performed, I am running a content script using the chrome.tabs.executeScript(null, {file: "contentscript.js"});
api.
How can I access SomeObject in the contentscript in this case?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…