制作一个简单的插件,在页面加载时执行javascript,我想在不同的页面上执行不同的javascript
但是以下代码没有按预期工作,没有触发“警报”:
background.html
:
<html><body>
<script>
chrome.webRequest.onCompleted.addListener(
function(details) {
alert (details.url);
},
{
urls: ["*"],
types: ["main_frame"]
},
[]
);
</script>
</body></html>
manifest.json
:
{
"name": "JS",
"background_page": "background.html",
"permissions": [
"webRequest",
"*"
],
"version":"0.10"
}