[英]Google.com and DOMContentLoaded
我使用content_scripts中的以下代码测试了我的Google Chrome扩展程序:
function test()
{
alert("test");
}
document.addEventListener("DOMContentLoaded", test, false);
表现:
{
"name": "Test",
"version": "1.0",
"manifest_version": 2,
"permissions": ["contextMenus", "tabs", "http://*/*", "https://*/*"],
"content_scripts": [{
"all_frames": true,
"js": [ "jquery-1.8.1.min.js","test.js"],
"matches": [ "http://*/*" ],
"run_at": "document_start"
}]
}
所有的网页,如Facebook或微软都可以。加载页面后,会弹出一个警告框,除了“Google.com”=>我访问了Google.com但没有警告框。 我想知道为什么除了Google.com之外几乎没有页面好吗? 那么,我需要在Google.com加载后捕获哪个DOM事件?
谢谢
Google始终使用https ,您的脚本不会注入任何https网站,因为您只定位http网站(在您的清单中,您有: "matches": [ "http://*/*" ],
)。
将您的清单更改为"matches": [ "http://*/*", "https://*/*" ],
或"matches": [ "<all_urls>" ],
.
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.