Quora: mute and stop autoplaying videos
Mutes and pauses videos that try to autoplay in the feed; they play only after you click them.
Code to copy
// Pause and mute any video that tries to autoplay in the feed
function tameVideos() {
document.querySelectorAll('video').forEach(function (v) {
if (v.dataset.jzTamed) { return; }
v.dataset.jzTamed = '1';
v.muted = true;
v.autoplay = false;
if (!v.paused) { v.pause(); }
v.addEventListener('play', function () {
if (!v.dataset.jzUserPlay) { v.pause(); }
});
v.addEventListener('click', function () { v.dataset.jzUserPlay = '1'; });
});
}
tameVideos();
const obs = new MutationObserver(tameVideos);
obs.observe(document.documentElement, { childList: true, subtree: true });
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.