谷歌浏览器出现#shadow-root(closed)里获取网页中资源时出现时的解决办法
一、简单使用
【F12】打开浏览器控制台,在控制台中粘贴以下代码,点击页面的刷新按钮(或【F5】),在页面未成功刷新之前按回车【Enter】键执行代码,等待页面刷新成功后,
#shadow-root (closed)将会改为#shadow-root (open):
Element.prototype._attachShadow = Element.prototype.attachShadow;
Element.prototype.attachShadow = function() {
return this._attachShadow({mode: 'open'});
};
二、通过油猴脚本自动加载以上代码
安装油猴扩展工具后,添加新脚本,将以上代码粘贴到新脚本中即可
// ==UserScript==
// @name 脚本名字
// @namespace http://tampermonkey.net/
// @version 2025-11-22
// @description try to take over the world!
// @author You
// @match 需要运行脚本的网址
// @icon https://www.google.com/s2/favicons?sz=64&domain=google.com
// @grant none
// ==/UserScript==
(function() {
'use strict';
Element.prototype._attachShadow = Element.prototype.attachShadow;
Element.prototype.attachShadow = function() {
return this._attachShadow({mode: 'open'});
};
})();


里获取网页中资源时出现时的解决办法&spm=1001.2101.3001.5002&articleId=155278356&d=1&t=3&u=b952f2df113e4401a1325344ec44210d)
2873

被折叠的 条评论
为什么被折叠?



