[英]Content script isn't running in iframe within another extension's page
Suppose that 2 extensions are installed in Google Chrome. 假设Google Chrome中安装了2个扩展程序。
1st extension runs content.js on w3.org: 第一个扩展在w3.org上运行content.js:
manifest.json: manifest.json的:
"content_scripts": [{
"matches": [ "https://www.w3.org/*" ],
"all_frames": true,
"js": [ "content.js" ]
}]
content.js: content.js:
alert('content');
2nd extension has page.html, which loads w3.org into iframe: 第二个扩展名有page.html,它将w3.org加载到iframe中:
manifest.json: manifest.json的:
"web_accessible_resources": ["page.html"]
page.html: page.html中:
<!DOCTYPE html>
<iframe src="https://www.w3.org/"></iframe>
Now enter in address bar chrome-extension://2nd-extension-id/page.html
. 现在输入地址栏
chrome-extension://2nd-extension-id/page.html
。 You will see w3.com, but content.js was not running (no alert()
window). 你会看到w3.com,但是content.js没有运行(没有
alert()
窗口)。 I do not see errors in console. 我没有在控制台中看到错误。
The question is: how to permit content script to run in this iframe? 问题是:如何允许内容脚本在此iframe中运行?
I created Chrome issue . 我创建了Chrome问题 。 Status: WontFix, unfortunately.
状态:WontFix,不幸的是。 But this is can be changed in future...
但是这可以在将来改变......
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.