Created
October 22, 2023 09:34
-
-
Save illixion/504b39fed4ea4f33773e46ac63eb96d3 to your computer and use it in GitHub Desktop.
A userscript to disable YouTube's single-page app behavior, also known as turbolinks, to force full page reloads on navigation
This file contains 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 YouTube Disable Turbolinks | |
// @namespace https://github.com/assistant | |
// @version 1.1 | |
// @description A userscript to disable YouTube's single-page app behavior, also known as turbolinks, to force full page reloads on navigation | |
// @match https://www.youtube.com/* | |
// @grant none | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
// Add an event listener for the 'yt-navigate-start' event | |
window.addEventListener('yt-navigate-start', function(e) { | |
e.preventDefault(); | |
// Get the new URL from the event detail object | |
var newUrl = e.detail && e.detail.url; | |
// If the new URL is different from the current one, reload the page | |
if (newUrl && newUrl !== location.href) { | |
location.reload(); | |
} | |
}); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment