您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
使所有的网页链接在新窗口打开
// ==UserScript== // @name 新窗口打开链接 // @namespace http://tampermonkey.net/ // @version 2025-08-15 // @description 使所有的网页链接在新窗口打开 // @author 2535688890 // @match *://*/* // @grant none // @license none // ==/UserScript== (function () { 'use strict'; const links = document.querySelectorAll('a'); links.forEach(function (link) { let href = link.getAttribute('href'); if (href?.startsWith('http') || href?.startsWith('//')) { link.setAttribute('target', '_blank'); } else if (href?.startsWith('/')) { link.setAttribute('href', window.location.origin + href); link.setAttribute('target', '_blank'); } }); })();