|
发表于 2023-11-26 22:59:21
|
显示全部楼层
本帖最后由 cne53102 于 2023-11-26 23:01 编辑
难受,上个tampermonkey的。
加上bilibili是just in case,加上weibo是有时候weibo会跳一下然后第二次才能打开
其他target看着加,@match也可以是多个
- // ==UserScript==
- // @name Disable Referer for multiple target domains from amobbs
- // @namespace http://tampermonkey.net/
- // @version 1.0
- // @description Disable Referer for links from amobbs to multiple target domains only, not affecting other websites' Referer headers.
- // @match https://www.amobbs.com/*
- // @icon https://www.amobbs.com/favicon.ico
- // @grant none
- // ==/UserScript==
- (function() {
- 'use strict';
- const targetUrls = [
- 'http://b23.tv',
- 'https://b23.tv',
- 'http://www.bilibili.com',
- 'https://www.bilibili.com',
- 'http://weibo.com',
- 'https://weibo.com',
- 'http://h5.video.weibo.com',
- 'https://h5.video.weibo.com'
- ];
- const links = document.getElementsByTagName('a');
- for (let i = 0; i < links.length; i++) {
- const link = links[i];
- for (let j = 0; j < targetUrls.length; j++) {
- const targetUrl = targetUrls[j];
- if (link.href.indexOf(targetUrl) === 0) {
- // Add rel=noreferrer to links that point to the target URLs
- link.rel = 'noreferrer';
- break;
- }
- }
- }
- })();
复制代码 |
|