您可以从扩展程序访问 chrome://页面吗? [英] Can you access chrome:// pages from an extension?
问题描述
在编写 manifest.json 文件时,您必须为内容脚本指定 matches
.http
和 https
工作正常,但如果我尝试包含 chrome://*/*
或它的任何变体,我会得到一个我试图为我的 matches
使用无效方案的错误.
When you're writing the manifest.json file, you have to specify matches
for your content scripts. The http
and https
work fine, but if I try to include chrome://*/*
or any variant of it, I get an error that I'm attempting to use an invalid scheme for my matches
.
不允许吗?
推荐答案
默认情况下,您无法在 chrome://
url 页面上运行.
By default you cannot run on a chrome://
url page.
但是,在chrome://flags/#extensions-on-chrome-urls
中有一个选项:
However, there is an option in chrome://flags/#extensions-on-chrome-urls
:
chrome://URL 上的扩展(Mac、Windows、Linux、Chrome 操作系统、Android)
允许在 chrome://URL 上运行扩展程序,其中扩展程序明确请求此权限.
Extensions on chrome:// URLs (Mac, Windows, Linux, Chrome OS, Android)
Enables running extensions on chrome:// URLs, where extensions explicitly request this permission.
您仍然必须指定您的扩展程序可以运行的页面并且不接受通配符 - 因此您必须指定完整的 URL,例如 chrome://extensions/
You still have to specify pages that your extension can run on and wildcards are not accepted - so you have to specify the full URL eg chrome://extensions/
这篇关于您可以从扩展程序访问 chrome://页面吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!