Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@nikhilkumarsingh
Created March 15, 2020 20:26
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nikhilkumarsingh/6c3756baad82d8ad70e3fda3a493e651 to your computer and use it in GitHub Desktop.
Save nikhilkumarsingh/6c3756baad82d8ad70e3fda3a493e651 to your computer and use it in GitHub Desktop.
Display the source blob
Display the rendered blob
Raw
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@CineZ209
Copy link

ok

@optionsx
Copy link

optionsx commented Dec 22, 2021

TamperMonkey has a built-in option for loading JS before or after document-load!

@kaushik-rishi
Copy link

@optionsx Thanks.
More info:

  • by default tampermonkey script runs after page loads
  • the option is @run-at document-idle
  • refer this for other options

@willasm
Copy link

willasm commented Dec 27, 2022

Great and very helpful video. Thanks!
The @run-at document-idle was not working for me for some reason? The addEventListener method however works as expected.

@znare
Copy link

znare commented Feb 18, 2023

Thank you! That was very helpful.

@optionsx
Copy link

@optionsx Thanks. More info:

* by default tampermonkey script runs after page loads

* the option is `@run-at document-idle`

* refer [this](https://www.tampermonkey.net/documentation.php#_run_at) for other options

yes but sometimes you may want to load some of the code after the page loads, and the rest while before the page completely is loaded. if you know what i mean

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment