chao_hl 发表于 2025-2-25 18:24

分享个macOS下强制打开桌面版网页的油猴脚本

iPhone上打开后收藏的如果是移动版网页,登录同一Apple ID账号的macOS收藏夹自动同步过来的也会是移动版网页,如m.thepaper.cn。手动改为www当然有些麻烦 ,求助DeepSeek给出了下面的篡改猴脚本,基本能满足需求:
// ==UserScript==
// @name         Mobile to Desktop Redirect (Optimized)
// @namespace    http://tampermonkey.net/
// @version      1.3
// @descriptionAutomatically redirect mobile URLs to desktop URLs before page loads, reducing delay
// @author       You
// @match      *://*/*
// @run-at       document-start
// @grant      none
// ==/UserScript==

(function() {
    'use strict';
    const mobilePrefixes = ['m.', 'mobile.', 'touch.']; // Add more prefixes if needed
    const hostname = window.location.hostname;

    // Check if the hostname starts with any mobile prefix
    const prefix = mobilePrefixes.find(p => hostname.startsWith(p));
    if (prefix) {
      // Replace the mobile prefix with 'www.'
      const newHostname = hostname.replace(prefix, 'www.');
      // Redirect to the new URL before page loads
      window.location.hostname = newHostname;
    }
})();

沐浴阳光雨 发表于 2025-2-26 05:16

chao_hl 发表于 2025-2-25 18:24
iPhone上打开后收藏的如果是移动版网页,登录同一Apple ID账号的macOS收藏夹自动同步过来的也会是移动版网 ...

万能的deepseek牛逼啊,你能用它帮我写个去除联想无线网卡白名单的bios,不知可不可以。
页: [1]
查看完整版本: 分享个macOS下强制打开桌面版网页的油猴脚本