尝试 hook 一下 shadow DOM
然后就可以操作 shadow DOM 中的文档了,只在 B 站和百度网盘上试了一下 ,不过只要不碰到 CSP 应该都没问题。```js
// ==UserScript==
// @name ShadowDom 劫持
// @namespace Violentmonkey Scripts
// @match *://*/*
// @grant none
// @version 0.0.1
// @author LinHQ
// @run-at document-start
// @inject-into page
// @description 2021/11/27 下午9:52:44
// ==/UserScript==
Element.prototype._attachShadow = Element.prototype.attachShadow;
Element.prototype.attachShadow = function(init){
init['mode'] = 'open';
//console.log('hooked');
return Element.prototype._attachShadow.call(this, init);
}
```
哥哥牛逼,又是一个我看不懂的代码 // @inject-into page 是个什么? 王一之 发表于 2021-11-28 11:43
// @inject-into page 是个什么?
应该是Violentmonkey的特性,似乎是为了解决firefox的注入问题:https://violentmonkey.github.io/posts/inject-into-context/ 李恒道 发表于 2021-11-28 10:52
哥哥牛逼,又是一个我看不懂的代码
不敢不敢,哥哥的功力比我强得多🤣
页:
[1]