Skip to content

Instantly share code, notes, and snippets.

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

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

Select an option

Save PedroHLC/e4c7225daea6140bd37357eb3afe79c5 to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name Disable Turbo on Basecamp
// @namespace https://gist.github.com/PedroHLC/e4c7225daea6140bd37357eb3afe79c5
// @version 1.0.1
// @author PedroHLC, Claude
// @description Completely disables Turbo Drive and Turbo Frames
// @match https://*.basecamp.com/*
// @run-at document-start
// @grant none
// @updateURL https://gist.github.com/PedroHLC/e4c7225daea6140bd37357eb3afe79c5/raw/basecamp-nuke-turbo.user.js
// @downloadURL https://gist.github.com/PedroHLC/e4c7225daea6140bd37357eb3afe79c5/raw/basecamp-nuke-turbo.user.js
// ==/UserScript==
(function() {
// 1. Add the meta tag that tells Turbo Drive to not handle visits
const meta = document.createElement('meta');
meta.name = 'turbo-visit-control';
meta.content = 'reload';
document.documentElement.appendChild(meta);
// 2. Disable Turbo Drive globally once it loads
document.addEventListener('turbo:before-visit', function(e) {
e.preventDefault();
window.location.href = e.detail.url;
});
// 3. Disable Turbo Frame loading — force full page navigation
document.addEventListener('turbo:before-fetch-request', function(e) {
// Only intercept if it's a full-page navigation, not an inline frame load
const frame = e.target.closest('turbo-frame');
if (!frame) {
e.preventDefault();
if (e.detail.url) {
window.location.href = e.detail.url.href || e.detail.url;
}
}
});
// 4. Disable Turbo prefetch (hover/touchstart prefetching)
document.addEventListener('turbo:before-prefetch', function(e) {
e.preventDefault();
});
// 5. Nuclear option: neuter the Turbo global when it appears
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