Chromium extensions: how to run content_script after starting all document listeners?

How to start the chromatic extension of content_script after window.load and after starting all other window.load listeners?

I am currently hacking a javascript site trying to improve its functionality. But I want such improvements to happen after everything is ready js is finished.

I really need a way to set a trigger after the site is ready to be fixed.

If there is no easy way to do this, did someone perform a general function that will work with JS top frames (jQuery, prototype, etc.)?

By the way, the execution of this will not work, since it will be launched in front of the script pages by listeners, which will be added later:

window.addEventListener("load", callback, false);
+3
source share
1 answer

Content_script

(discussion of the Manifest property content_scripts.run_at)

Listening to the onload event is not required for content scripts running in document_idle because they are guaranteed to execute after the DOM completes.

Being document_idle in default mode, it should work as you expected, but you do not need to add a listener to load the page, just write the JS that you want to enter.

+2
source

Source: https://habr.com/ru/post/1725488/


All Articles