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/matching.md
+34Lines changed: 34 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -92,3 +92,37 @@ Here is the long version:
92
92
- If neither `@match` nor `@include` rule is defined, the script is assumed to match.
93
93
94
94

95
+
96
+
Matching SPA sites like fb, github, twitter, youtube
97
+
---
98
+
99
+
Userscript extensions use the native behavior of the browser - it runs scripts defined by extensions only during the standard "hard" navigation, not during "soft" navigation via history.pushState or replaceState or #hash changes used by many modern [SPA sites](https://en.wikipedia.org/wiki/Single-page_application).
100
+
101
+
You can verify the type by opening devtools network log, then navigate in this tab (e.g. click a link) and look at the type of the request for this navigation: a `Document` (Chrome) or `HTML` (Firefox) means "hard" navigation i.e. the browser creates a new environment for the page and loads its HTML from the server including its scripts and userscripts from extensions.
102
+
103
+
**1. Run your userscript on the entire SPA site:**
104
+
```js
105
+
// @match *://www.youtube.com/*
106
+
```
107
+
**2. Then watch for changes** either using [vm-url](https://github.com/violentmonkey/vm-url) or manually:
0 commit comments