javascript - 创建扩展并尝试更改网页背景颜色但权限失败
问题描述
我正在尝试使用以下代码更改活动选项卡网页的背景颜色:
来自 popup.js 的代码
chrome.tabs.executeScript(null, {code:"document.body.bgColor='red'"});
manifest.json 的代码
"permissions": ["storage", "activeTab", "tabs", "<all_urls>"]
扩展错误日志将此报告为问题:
Unchecked runtime.lastError: Cannot access contents of url "chrome-search://local-ntp/local-ntp.html".
Extension manifest must request permission to access this host.
对于上述错误,我的活动标签中有 google.co.uk,我还尝试了其他网页以确认问题不是特定于特定网页。
为什么我的权限不包括这个?
解决方案
推荐阅读
- java - graphviz/DOT 子图/集群错误标签和颜色属性不允许
- swift - LSCopyDefaultHandlerForURLScheme 检查当前应用程序是否是默认浏览器的替代方法?
- python - HTTP 令牌生成在 Python 请求中不起作用
- regex - 在 grep 正则表达式中匹配 X 或 Y
- spring-boot - SpringBoot Kafka Stream在哪里添加StateStore
- groovy - 为什么在尝试使用新的 Groovy 3.0.4 编译器进行编译时出现 NoClassDefFoundError 错误?
- laravel - laravel 身份验证重定向
- reactjs - React Hooks:这种全局状态模式的陷阱?
- linux - 获取mpv中当前播放文件的完整路径
- rxjs - 为什么 EMPTY 不能完成 observable?