您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Greasy Fork is available in English.
跳过下载引导,防止跳转和 prompt 弹窗
// ==UserScript== // @name 跳过 百度(Baidu) App 下载提示 (No Popup) // @namespace http://tampermonkey.net/ // @version 1.1 // @description 跳过下载引导,防止跳转和 prompt 弹窗 // @author viewtheard // @license GPL-3.0 // @match *://*.baidu.com/* // @grant none // @run-at document-start // ==/UserScript== (function () { // 模拟 userAgent 为百度App Object.defineProperty(navigator, 'userAgent', { get: function () { return 'Mozilla/5.0 (Linux; Android 10) AppleWebKit/537.36 (KHTML, like Gecko) baiduboxapp/13.5.0.10 Mobile Safari/537.36'; } }); // 提前定义 swanInvoke,阻止跳转 window.swanInvoke = function (args) { console.log('[油猴] 假装已打开小程序: ', args); }; // 阻止 history.back,留在当前页 history.back = function () { console.log('[油猴] 阻止 history.back 调用'); }; // 屏蔽 JSBridge 的 prompt 弹窗调用 window.prompt = function (msg) { if (typeof msg === 'string' && msg.startsWith('BdboxApp:')) { console.log('[油猴] 拦截 JSBridge prompt 调用: ', msg); return ''; // 返回空字符串,避免触发异常逻辑 } return null; }; // 防止 swanInvoke 脚本加载 const observer = new MutationObserver((mutationsList) => { for (const mutation of mutationsList) { for (const node of mutation.addedNodes) { if (node.tagName === 'SCRIPT' && node.src && node.src.includes('swanInvoke')) { node.parentElement.removeChild(node); console.log('[油猴] 移除 swanInvoke 脚本'); } } } }); observer.observe(document.documentElement, { childList: true, subtree: true }); })();