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.2
// @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() {
// GitHub checks this meta tag natively
const meta = document.createElement('meta');
meta.name = 'disable-turbo';
meta.content = 'true';
document.documentElement.appendChild(meta);
// Override meta element's content property for disable-turbo
const originalSetAttribute = Element.prototype.setAttribute;
Element.prototype.setAttribute = function(name, value) {
if (this.tagName === 'META' && this.name === 'disable-turbo' && name === 'content') {
return originalSetAttribute.call(this, name, 'true');
}
return originalSetAttribute.call(this, name, value);
};
// Belt-and-suspenders: also set the standard turbo visit control
const meta2 = document.createElement('meta');
meta2.name = 'turbo-visit-control';
meta2.content = 'reload';
document.documentElement.appendChild(meta2);
// Intercept Turbo 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();
});
// Disable Turbo.session.drive when it initializes
Object.defineProperty(window, 'Turbo', {
set(val) {
if (val && val.session) {
val.session.drive = false;
}
this._Turbo = val;
},
get() { return this._Turbo; },
configurable: true
});
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment