YouTube redirect to mobile

Redirect YouTube desktop site to mobile site

安装此脚本?
作者推荐脚本

您可能也喜欢youtube profile picture hd

安装此脚本
  1. // ==UserScript==
  2. // @name YouTube redirect to mobile
  3. // @namespace YouTube redirect to mobile
  4. // @match https://www.youtube.com/*
  5. // @run-at document-start
  6. // @grant none
  7. // @version 1.2
  8. // @description Redirect YouTube desktop site to mobile site
  9. // ==/UserScript==
  10.  
  11. (function() {
  12. 'use strict';
  13. // Check if the current URL is the desktop version of YouTube
  14. if (window.location.hostname === 'www.youtube.com') {
  15. // Redirect to the mobile version
  16. window.location.href = 'https://m.youtube.com' + window.location.pathname + window.location.search;
  17. }
  18. })();