Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

似乎有一些图片挂了,临时解决办法 #48

Open
Lemon-giser opened this issue Mar 26, 2024 · 0 comments
Open

似乎有一些图片挂了,临时解决办法 #48

Lemon-giser opened this issue Mar 26, 2024 · 0 comments

Comments

@Lemon-giser
Copy link

看起来是csdn图床加了防盗链处理,解决方法是在img标签上加个referrerPolicy="no-referrer"或者是在html里加个 <meta name="referrer" content="no-referrer" />
这里写了一个油猴脚本

// ==UserScript==
// @name         恢复图片显示
// @namespace    http://tampermonkey.net/
// @version      2024-03-26
// @description  try to take over the world!
// @author       You
// @match        https://snailclimb.gitee.io/springboot-guide/
// @icon         https://www.google.com/s2/favicons?sz=64&domain=gitee.io
// @grant        none
// ==/UserScript==

(function() {
    'use strict';
    setTimeout(() => {
        // 获取页面上的所有img标签
        var imgElements = document.getElementsByTagName('img');

        // 遍历所有img标签并添加referrerPolicy属性
        for (var i = 0; i < imgElements.length; i++) {
            imgElements[i].setAttribute('referrerPolicy', 'no-referrer');
        }
    }, 2000)

    // Your code here...
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant