Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Disable YouTube Autoplay automatically
// ==UserScript==
// @version 1.0.0
// @name Autoplay Off
// @description Sets Autoplay to `Off` by default
// @include http*://*.youtube.com/*
// @run-at document-end
// @grant none
// @noframes
// ==/UserScript==
(function () {
'use strict';
function disableAutoplay() {
setTimeout(function() {
var checkbox = document.getElementById('autoplay-checkbox');
if (checkbox && checkbox.checked === true) {
checkbox.click();
}
}, 2000);
}
window.addEventListener('readystatechange', disableAutoplay, true);
}());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.