I defined a global object in a .js file. For example, file1.js contains the SomeObject global object. This file is loaded in background.html.
Since file1.js is included in background.html, I can access the global object on this page. Therefore, there are no problems here.
When an event such as clicking on the extension button is executed, I run the contents of the script using chrome.tabs.executeScript(null, {file: "contentscript.js"});api.
How can I access SomeObject in a text file in this case?
source
share