content_scripts 是否匹配“chrome-extension://*/*"?工作? [英] Does content_scripts matches "chrome-extension://*/*" work?

查看:31
本文介绍了content_scripts 是否匹配“chrome-extension://*/*"?工作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在带有 chrome-extension://URL 的 iframe 上运行内容脚本.我在 manifest.json 中添加了一行,该行是从文档中复制出来的 http://code.google.com/chrome/extensions/match_patterns.html

I want to run a content script on an iframe with a chrome-extension:// URL. I added a line to my manifest.json that I copied out of the documentation http://code.google.com/chrome/extensions/match_patterns.html

 chrome-extension://*/*

但是当我重新加载我的扩展程序时,我收到一个警报:

But when I reload my extension I get an alert:

Could not load extension from '/work/sirius/extension'. 
Invalid value for 'content_scripts[2].matches[0]': Invalid scheme.

知道如何让它发挥作用吗?

Any idea how to get this to worK?

推荐答案

没有.只有 ftp:file:http:https: 可以与内容脚本声明匹配.

No. Only ftp:, file:, http: and https: can be matched by a content script declaration.

任何 matchesexclude_matches 字段中的无效 URL 模式被拒绝(在尝试加载扩展时产生错误).

Invalid URL patterns at any of the matches and exclude_matches fields are rejected (generating an error when trying to load the extension).

清单文件中 permissions 选项中的无效模式是忽略.

Invalid patterns at the permissions option in the manifest file are ignored.

如果您想在扩展程序的选项卡上运行脚本,请使用 chrome.extension.getViews 在您的后台脚本中.更好的是,设计您的扩展程序的页面,使它们有效地相互通信 (示例).

If you want to run a script on a tab from your extension, use chrome.extension.getViews in your background script. Even better, design your extension's pages such that they effectively communicate with each other (example).

这篇关于content_scripts 是否匹配“chrome-extension://*/*"?工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆