🏠 Home 

YouTube Redirect Remover

Remove the annoying "Are you sure you want to leave YouTube?"


安装此脚本?
  1. // ==UserScript==
  2. // @name YouTube Redirect Remover
  3. // @version 1.0
  4. // @description Remove the annoying "Are you sure you want to leave YouTube?"
  5. // @author yodaluca23
  6. // @license GNU GPLv3
  7. // @match *://www.youtube.com/redirect*
  8. // @namespace https://greasyfork.org/users/1315976
  9. // ==/UserScript==
  10. (function() {
  11. 'use strict';
  12. const currentUrl = window.location.href;
  13. // Check if the URL contains the "?q=" parameter
  14. const urlParams = new URLSearchParams(window.location.search);
  15. const targetUrl = urlParams.get('q');
  16. if (targetUrl) {
  17. // Decode the URL
  18. const decodedUrl = decodeURIComponent(targetUrl);
  19. // Redirect the browser to the decoded URL
  20. window.location.href = decodedUrl;
  21. } else {
  22. console.error('No "q" parameter found in the URL.');
  23. }
  24. })();