You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何在Firefox中禁用已访问链接隐私检查,让JS可访问已访问链接?

在Firefox中让Tampermonkey脚本访问已访问链接的方法

要在你自己的Firefox浏览器里突破检测已访问链接的安全限制,可通过以下步骤实现:

1. 调整Firefox核心配置

这些修改仅作用于你的本地浏览器,不会影响其他用户:

  • 在地址栏输入 about:config,点击“接受风险并继续”进入配置页面
  • 找到 privacy.resistFingerprinting,将其值设为 false(如果原本是true)。该选项会强制统一所有链接的样式,隐藏已访问状态,必须关闭才能让脚本检测到差异
  • 找到 layout.css.getComputedStyle.visited,将其值设为 true。默认浏览器禁止脚本通过getComputedStyle读取已访问链接的样式,开启此配置即可解除该限制

2. 编写Tampermonkey脚本示例

配置完成后,你可以编写脚本来识别已访问/未访问链接:

// ==UserScript==
// @name         识别未访问链接
// @namespace    http://tampermonkey.net/
// @version      0.1
// @match        https://目标域名/*  // 替换成你需要的域名
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    // 生成一个未访问的测试链接,获取默认未访问颜色
    const testLink = document.createElement('a');
    testLink.href = 'https://example.com/never-visited-link';
    document.body.appendChild(testLink);
    const unvisitedColor = getComputedStyle(testLink).color;
    document.body.removeChild(testLink);

    // 遍历页面所有链接,筛选未访问的
    document.querySelectorAll('a').forEach(link => {
        const linkColor = getComputedStyle(link).color;
        if (linkColor === unvisitedColor) {
            // 这里处理未访问链接,比如添加标记
            link.style.borderLeft = '3px solid red';
            console.log('未访问链接:', link.href);
        }
    });
})();

注意:开启layout.css.getComputedStyle.visited会让所有网站的脚本都能读取已访问链接状态,存在一定隐私风险,仅在你信任的网站上运行脚本即可。

内容的提问来源于stack exchange,提问作者Ariakas

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.08 20:05:12