v2ex-open-new-page

在 v2ex 里,所有的 a 标签自动打开新页面

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name         v2ex-open-new-page
// @namespace    http://tampermonkey.net/
// @version      2024-03-12
// @description  在 v2ex 里,所有的 a 标签自动打开新页面
// @author       @zhixiangyao
// @match        https://www.v2ex.com/
// @icon         https://www.google.com/s2/favicons?sz=64&domain=v2ex.com
// @grant        none
// @license      MIT
// ==/UserScript==

(function() {
    'use strict';
    // 创建一个 base 元素
    var baseElement = document.createElement('base');
    // 设置 target 属性为 "_blank"
    baseElement.setAttribute('target', '_blank');
    // 将 base 元素插入到页面的 head 元素中
    document.head.appendChild(baseElement);
})();