Stop video autoplay
Pauses every video in the feed and watches new elements so videos no longer start on their own.
Code to copy
(function () {
function pause(root) {
try {
(root || document).querySelectorAll('video').forEach(function (v) {
if (!v.paused) { v.pause(); }
v.autoplay = false;
v.removeAttribute('autoplay');
});
} catch (e) {}
}
pause(document);
try {
var mo = new MutationObserver(function (muts) {
muts.forEach(function (m) {
m.addedNodes && m.addedNodes.forEach(function (n) {
if (n.nodeType === 1) { pause(n); }
});
});
});
mo.observe(document.documentElement, { childList: true, subtree: true });
} catch (e) {}
})();
How to use this example
- Copy the code with the button above.
- Install JustZix (2 minutes) and open the extension on the target page.
- Add a new rule matching that page.
- Paste the code into the rule's JavaScript panel and save — it runs on every page visit.
Rate this example
No ratings yet — be the first.