Last active
February 24, 2026 16:32
-
-
Save PedroHLC/f6f238834f5ebdfaff5c1bf907745fcb to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // ==UserScript== | |
| // @name Disable Turbo on GitHub | |
| // @namespace https://gist.github.com/PedroHLC/f6f238834f5ebdfaff5c1bf907745fcb | |
| // @version 1.0.1 | |
| // @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); | |
| // Watch for GitHub's disable-turbo meta tag and flip it to true | |
| new MutationObserver((mutations) => { | |
| for (const m of mutations) { | |
| for (const node of m.addedNodes) { | |
| if (node.nodeType === 1 && node.tagName === 'META' && node.name === 'disable-turbo') { | |
| node.content = 'true'; | |
| } | |
| } | |
| } | |
| }).observe(document.documentElement, { childList: true, subtree: true }); | |
| // 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