Skip to content

Instantly share code, notes, and snippets.

@PedroHLC
Last active February 24, 2026 16:32
Show Gist options
  • Select an option

  • Save PedroHLC/f6f238834f5ebdfaff5c1bf907745fcb to your computer and use it in GitHub Desktop.

Select an option

Save PedroHLC/f6f238834f5ebdfaff5c1bf907745fcb to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name Disable Turbo on GitHub
// @namespace https://gist.github.com/PedroHLC/f6f238834f5ebdfaff5c1bf907745fcb
// @version 1.0.13
// @author PedroHLC, Claude
// @description Completely disables Turbo Drive on GitHub
// @match https://github.com/*
// @run-at document-start
// @grant none
// @updateURL https://gist.github.com/PedroHLC/f6f238834f5ebdfaff5c1bf907745fcb/raw/github-nuke-turbo.user.js
// @downloadURL https://gist.github.com/PedroHLC/f6f238834f5ebdfaff5c1bf907745fcb/raw/github-nuke-turbo.user.js
// ==/UserScript==
(function() {
// Disable Turbo Drive when it initializes (but don't disconnect — breaks previews)
Object.defineProperty(window, 'Turbo', {
set(val) {
if (val?.session) {
val.session.drive = false;
}
this._Turbo = val;
},
get() { return this._Turbo; },
configurable: true
});
// Make disable-turbo meta always report true when read
const origGetAttribute = HTMLMetaElement.prototype.getAttribute;
HTMLMetaElement.prototype.getAttribute = function(name) {
if (name === 'content' && this.name === 'disable-turbo') return 'true';
return origGetAttribute.call(this, name);
};
// Intercept Turbo Drive navigations
document.addEventListener('turbo:before-visit', function(e) {
e.preventDefault();
window.location.href = e.detail.url;
});
// Kill prefetch
document.addEventListener('turbo:before-prefetch', function(e) {
e.preventDefault();
});
// Only disable the main navigation turbo-frame, leave others alone
new MutationObserver(() => {
document.querySelectorAll('[data-turbo-frame="repo-content-turbo-frame"]').forEach(el => {
el.removeAttribute('data-turbo-frame');
});
const navFrame = document.getElementById('repo-content-turbo-frame');
if (navFrame) navFrame.setAttribute('disabled', '');
}).observe(document.documentElement, { childList: true, subtree: true });
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment