王一之 发表于 2021-11-25 16:30:14

李恒道 发表于 2021-11-25 15:47
印象里script和img都是没有跨域限制的吧

没有跨域,但是有防盗链

ThisAV 发表于 2021-12-10 17:02:10

本帖最后由 ThisAV 于 2021-12-10 17:10 编辑

李恒道 发表于 2021-11-25 14:49
// ==UserScript==
// @name         New Userscript
// @namespace    http://tampermonkey.net/

binary += String.fromCharCode(bytes);
这里少了下标
binary += String.fromCharCode(bytes);
还是要有用Code标签的习惯啊
这个转Base64的方法挺好的,我怎么就没想到呢https://cdn.jsdelivr.net/gh/master-of-forums/master-of-forums/public/images/patch.gif

李恒道 发表于 2021-12-10 17:26:50

ThisAV 发表于 2021-12-10 17:02
这里少了下标

还是要有用Code标签的习惯啊


我直接对抄的csdn,跑起来就没怎么注意细节了{:4_110:}

王一之 发表于 2022-12-1 22:59:41

挖坟,这样貌似可以突破

```js
// ==UserScript==
// @name         gm add element
// @namespace    https://bbs.tampermonkey.net.cn/
// @version      0.1.0
// @descriptiontry to take over the world!
// @author       You
// @match      https://github.com/scriptscat/scriptcat
// @grantGM_addElement
// ==/UserScript==

// const div = document.createElement('img');
// div.src = "https://bbs.tampermonkey.net.cn/uc_server/avatar.php?uid=4&size=small&ts=1";

// document.querySelector('.BorderGrid-cell').appendChild(div);

GM_addElement(document.querySelector('.BorderGrid-cell'),"img",{
    src:"https://bbs.tampermonkey.net.cn/uc_server/avatar.php?uid=4&size=small&ts=1"
});

```

页: 1 [2]
查看完整版本: 图像加载遇到“内容安全策略”有解决办法吗?