You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/api/metadata-block.md
+5-7
Original file line number
Diff line number
Diff line change
@@ -133,25 +133,23 @@ Examples:
133
133
134
134
### @run-at
135
135
136
-
Decide when the script will execute.
137
-
138
-
Several values can be set for `@run-at`:
136
+
Specifies **when** the script will run.
139
137
140
138
-`document-start`
141
139
142
-
The userscript executes as early as possible, `document.documentElement` is present, but may be without either `document.head` or `document.body` or both. Other scripts in the page may run earlier, see the note below.
140
+
Run as early as possible, `document.documentElement` is present, but may be without either `document.head` or `document.body` or both. Other scripts in the page may run earlier, see the note below.
143
141
144
142
-`document-body`*(since v2.12.10)*
145
143
146
-
The userscript executes after `document.body` appears, possibly with some child elements inside, because detection is asynchronous (using a one-time MutationObserver).
144
+
Run after `document.body` appears, possibly with some child elements inside, because detection is asynchronous (using a one-time MutationObserver).
147
145
148
146
-`document-end` <Labelname="default" />
149
147
150
-
The userscript executes when `DOMContentLoaded` is fired synchronously. At this time, the basic HTML of the page is ready and other resources like images might still be on the way.
148
+
Run when `DOMContentLoaded` is fired, synchronously. At this time, the basic HTML of the page is ready and other resources like images might still be on the way.
151
149
152
150
-`document-idle`
153
151
154
-
The userscript executes after `DOMContentLoaded` is fired asynchronously, i.e. after yielding to the previously scheduled callbacks or urgent tasks like rendering. Prefer this mode for scripts that take more than a couple of milliseconds to compile and run (you can see it in devtools performance profiler), so that they don't delay the moment the page becomes usable.
152
+
Run after `DOMContentLoaded` is fired, asynchronously, i.e. after yielding to the previously scheduled callbacks or urgent tasks like rendering. Prefer this mode for scripts that take more than a couple of milliseconds to compile and run (you can see it in devtools performance profiler), so that they don't delay the moment the page becomes usable.
155
153
156
154
When using `document-start` in Violentmonkey ManifestV2 there's a limited method of ensuring the userscript runs before other scripts in the page:
0 commit comments