Reputation: 7369
Is it possible to delay or stop the loading, parsing, and execution of web page JavaScripts until the extension fetches the saved settings from chrome.storage
and performs initial setup?
Even though, the content script
is set to "run_at": "document_start"
, because of the asynchronous nature of the chrome.storage
read, while the stored configuration settings are being read using chrome.storage.local.get()
, it appears that the web page also starts parsing and executing the page scripts simultaneously.
However, the extension wants to perform some initial configuration by running some content scripts based upon previously saved settings, hence the need for a way to pause or delay the execution of the scripts until the initial setup is complete which also injects a content script to the page which is supposed to be fully executed before the page scripts.
***Note - This question is strictly about delaying or pausing the execution of the web page's scripts, and it is already set to "run_at": "document_start". Currently using manifest v2, but solution for either v2 or v3 is fine. ***
Upvotes: 2
Views: 145