Referencing this question/answer...
I have a Chrome Extension content script that I want to interact with iFrames on a specific page. I can see that my content script executes before the page finishes loading...
I tried adding document ready (which I haven't done before - I didn't think it applied to a content script) and it just executes first - before everything else.
$(document).ready(function () {
console.log('DOM finally loaded with iFrame...');
});
Here is my manifest section on content_scripts - I just added the document_idle based on the discussion in the linked question.
Is it possible to have code in a content script wait for the complete page load (including iFrames)? Or do I need to add listeners to the content script that 'see' elements I know will finally appear, then take action?
"content_scripts": [
{
"matches": ["http://*/*","https://*/*"],
"js": ["/dscripts/jquery-3.1.1.min.js", "/scripts/content.js"],
"all_frames" : true,
"match_about_blank": true,
"run_at": "document_idle"
}
],