找回密码
 注册
快捷导航
查看: 54|回复: 2

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

[复制链接] |自动提醒
阅读字号:

1774

回帖

21

积分

4440

资产值

白金会员 Rank: 3Rank: 3Rank: 3

注册时间
2010-5-26
发表于 2025-2-25 18:24:35| 字数 805| - 中国–陕西–咸阳 移动 来自iOS客户端 | 显示全部楼层 |阅读模式
iPhone上打开后收藏的如果是移动版网页,登录同一Apple ID账号的macOS收藏夹自动同步过来的也会是移动版网页,如m.thepaper.cn。手动改为www当然有些麻烦 ,求助DeepSeek给出了下面的篡改猴脚本,基本能满足需求:
// ==UserScript==
// @name         Mobile to Desktop Redirect (Optimized)
// @namespace    http://tampermonkey.net/
// @version      1.3
// @description  Automatically 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;
    }
})();
T410s,一代i5+4G*2,经典键盘+16:10屏,Excel算盘机;
RMBP 2015 15顶配2.8/16/512/M370X,本想作备用机……

8

回帖

0

积分

66

资产值

入门会员 Rank: 1

注册时间
2025-2-24
发表于 2025-2-26 05:16:54| 字数 138| - 中国–江苏–南京 电信 来自手机版 | 显示全部楼层
QUOTE:
chao_hl 发表于 2025-2-25 18:24
iPhone上打开后收藏的如果是移动版网页,登录同一Apple ID账号的macOS收藏夹自动同步过来的也会是移动版网 ...

万能的deepseek牛逼啊,你能用它帮我写个去除联想无线网卡白名单的bios,不知可不可以。

点评

你可以试试。我现在工作中,就用DS写的Python批量下载上市公司公告。  发表于 2025-2-26 10:18
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

Powered by Discuz! X3.5 © 2001-2023 Comsenz Inc

GMT+8, 2025-2-28 23:49 , Processed in 0.094612 second(s), 27 queries , Gzip On, OPcache On.

手机版|小黑屋|安卓客户端|iOS客户端|Archiver|备用网址1|备用网址2|在线留言|专门网

返回顶部