On some websites, HTML tags load after certain events occur (javascript function loading a query or search, or user needs to scroll down).
When writing your own javascript functions to try to edit these tags via window.onload
, since the tags technically don't exist yet, the function does nothing. Placing the functions at the bottom of the body doesn't work, since those tags do not load after waiting a bit of time, but after their associated javascript functions create them.
For example, if you wanted to change the grey-black colour of the divs in Google Images after a search (which loads more pictures as you scroll down, but doesn't do anything if you don't), even you attempt to write a Greasemonkey script to perform actions with window.onload
, it would not do anything after scrolling down since it's already loaded.
Would a possible (but crude) solution be to re-run the function each time the user scrolls down (like a mouse listener of sorts)? Or would you recommend another method? Just delaying the function doesn't quite work since it would depend on when the user decides to scroll.