感觉是脚本设置的问题,复制粘贴,重新创建一个脚本试试
刚刚卸载插件.然后重新安装,还是不行, 哈哈哈. 看来 我只能在video脚本顶部手动过滤一下 域名了.目前原因不明
!(data/attachment/forum/202606/25/170343bvol1lbgeg37grer.png) uuorz 发表于 2026-6-25 17:04
刚刚卸载插件.然后重新安装,还是不行, 哈哈哈. 看来 我只能在video脚本顶部手动过滤一下 域名了.目 ...
那真见鬼了。。。复现不出来 哥哥导出文件包出来呢? 王一之 发表于 2026-6-25 18:08
那真见鬼了。。。复现不出来 哥哥导出文件包出来呢?
!(data/attachment/forum/202606/26/085133juqiin3hin9p3asn.png)
第一个脚本导出的option
```{"options":{"check_for_updates":false,"comment":null,"compat_foreach":false,"compat_metadata":false,"compat_prototypes":false,"compat_wrappedjsobject":false,"compatopts_for_requires":true,"noframes":null,"override":{"merge_connects":true,"merge_excludes":true,"merge_includes":true,"merge_matches":true,"orig_connects":[],"orig_excludes":["*://localhost"],"orig_includes":[],"orig_matches":["http://*/*","https://*/*"],"orig_noframes":true,"orig_run_at":"document-idle","use_blockers":[],"use_connects":[],"use_excludes":[],"use_includes":[],"use_matches":[]},"run_at":null},"settings":{"enabled":true,"position":1},"meta":{"name":"u - APP","uuid":"eee3283b-035c-5c7b-b28e-6ca93be1720f","sc_uuid":"eee3283b-035c-5c7b-b28e-6ca93be1720f","modified":1782434566973,"file_url":""}}```
另一个脚本的option:
```
{"options":{"check_for_updates":false,"comment":null,"compat_foreach":false,"compat_metadata":false,"compat_prototypes":false,"compat_wrappedjsobject":false,"compatopts_for_requires":true,"noframes":null,"override":{"merge_connects":true,"merge_excludes":true,"merge_includes":true,"merge_matches":true,"orig_connects":[],"orig_excludes":["*://*.douyin.com/*","*://*.kuaishou.com/*","*://localhost*"],"orig_includes":[],"orig_matches":["http://*/*","https://*/*"],"orig_noframes":null,"orig_run_at":"document-idle","use_blockers":[],"use_connects":[],"use_excludes":[],"use_includes":[],"use_matches":[]},"run_at":null},"settings":{"enabled":true,"position":2},"meta":{"name":"u - video","uuid":"f1b5e54e-26d3-5305-801a-9a2d4bf55e9d","sc_uuid":"f1b5e54e-26d3-5305-801a-9a2d4bf55e9d","modified":1782434566975,"file_url":""}}
```
不知道怎么上传zip文件. 代码很长. 就没贴代码了. storage 都是空的.只有option.json 有内容, 似乎没有什么有效信息,没有其他哥哥反馈, 估计是个例吧. uuorz 发表于 2026-6-26 08:59
!(data/attachment/forum/202606/26/085133juqiin3hin9p3asn.png)
第一个脚本导出的optio ...
哥哥直接导出备份文件,然后上传,最好的话可以在GitHub上发一下
https://github.com/scriptscat/scriptcat/issues/new?template=bug_report.yaml&scriptcat-version=1.4.0&browser-version=Mozilla%2F5.0%20(Macintosh%3B%20Intel%20Mac%20OS%20X%2010_15_7)%20AppleWebKit%2F537.36%20(KHTML%2C%20like%20Gecko)%20Chrome%2F149.0.0.0%20Safari%2F537.36%20Edg%2F149.0.0.0 你重新载入网页 ( Ctrl+R)看看 你最初的那个截图没有截到网址列,判断不了 cyfung1031 发表于 2026-6-26 21:12
你最初的那个截图没有截到网址列,判断不了
感谢大佬回复. 找到问题了. // @noframes 的原因 王一之 发表于 2026-6-26 11:15
哥哥直接导出备份文件,然后上传,最好的话可以在GitHub上发一下
https://github.com/scriptscat/script ...
搞了好几天. 终于发现问题了.是因为video.js里面没有 // @noframes 今天我重构代码发现. 至于之前为什么不行.只能理解为缓存了吧.哥哥认为// @exclude排除了这个页面了. 即使没有noframes 他的三方请求是不是也应该拦截呢.我不清楚逻辑. 只是请教. 这个问题最准确的理解是:
**`@exclude` 只排除“当前这个文档 / frame 的 URL”,它不会把整个浏览器标签页里的所有 iframe 一起排除,更不会拦截第三方网络请求。**
比如你的脚本是:
```js
// @match http://*/*
// @match https://*/*
// @exclude*://*.douyin.com/*
```
当打开:
```text
https://www.douyin.com/
```
顶层页面 URL 匹配了 `@exclude`,所以:
```text
抖音主页面
→ 不执行 video.js
```
这个没问题。
但是如果抖音页面里面有一个 iframe:
```html
<iframe src="https://example.com/player">
```
那么这个 iframe 是一个**独立的文档**。
ScriptCat / Tampermonkey 会重新判断它自己的 URL:
```text
iframe URL:
https://example.com/player
@match https://*/* → 匹配
@exclude *.douyin.com/*→ 不匹配
```
所以结果就是:
```text
video.js 会在这个 iframe 里面运行
```
这就是为什么即使抖音主页面已经被 `@exclude`,你后来还是可能看到 `u-video` 出现。
### `@noframes` 是干什么的?
加上:
```js
// @noframes
```
意思就是:
> 这个用户脚本只在顶层页面运行,不要在任何 iframe 里面运行。
所以变成:
```text
抖音主页面
→ 被 @exclude 排除
抖音里面的 iframe
→ 被 @noframes 阻止
最终 video.js 完全不会运行
```
所以楼主这句话:
> `@exclude` 排除了这个页面了,即使没有 `noframes`,他的三方请求是不是也应该拦截呢?
正确答案是:
**不是。**
因为这里其实不应该叫“三方请求”。
更准确应该说是:
**第三方 iframe / 子 frame。**
`@exclude` 不负责阻止 iframe,也不负责阻止网络请求。
它只是在判断:
```text
“这个 URL 对应的 document,要不要注入这个 userscript?”
```
可以把逻辑简单理解成:
```text
对每一个 document / iframe 单独判断:
1. 是否匹配 @match
2. 是否没有匹配 @exclude
3. 如果是 iframe,是否允许 frame 运行
```
如果没有:
```js
// @noframes
```
那么 iframe 也会单独进行 `@match / @exclude` 判断。
### 最后那句话真正想表达的意思
他说的大意是:
> 如果你的脚本是全站匹配的,那你可能本来就希望它在 iframe 里面运行。
>
> 如果只因为“父页面被 exclude 了”,就连 iframe 也全部自动禁止,那么 iframe 里面原本应该执行的脚本也不会运行,这反而会造成另外的问题。
所以设计逻辑是:
```text
父页面被 @exclude
≠
所有子 iframe 自动被 @exclude
```
而是:
```text
父页面看父页面自己的 URL
iframe 看 iframe 自己的 URL
```
如果你想表达:
> **“无论 iframe 是什么域名,我都不想让脚本在 iframe 里运行。”**
那才应该使用:
```js
// @noframes
```
还有一个很重要的区别:
如果楼主所说的“三方请求”真的是:
```text
fetch
XMLHttpRequest
图片请求
视频请求
JS 请求
API 请求
```
那么:
```text
@exclude
```
和:
```text
@noframes
```
**都不会拦截这些网络请求。**
所以一句话总结:
> **`@exclude` 是按每个 document / iframe 的 URL 独立判断是否运行脚本;`@noframes` 才是禁止脚本进入 iframe。父页面被 `@exclude`,并不代表它里面其他域名的 iframe 也自动被排除。**
页:
1
[2]