Reputation: 2905
There's a function on a page that I want to call after it loads. I do not own the page, so I can't insert any html into it. Can you please provide specific examples how to do this with some chrome extension or greasemonkey? (function is submitAction()
).
Upvotes: 6
Views: 13759
Reputation: 382444
Both Chrome extensions and greasemonkey offer ways to specify when the script you inject if executed.
In Chrome extension, you set that in the manifest :
"content_scripts": [
{
"run_at" : "document_idle",
In GreaseMonkey compatible userscripts, you set that in the metadata
// @run-at document-end
In both cases, you just have to add this to your script if you want to ensure resources are loaded when your function is executed :
document.addEventListener('load', submitAction);
Upvotes: 19