我想开发一个chrome扩展并添加自定义CSS和JS;
我有这两个文件:
manifest.json
{
"name": "Block request",
"version": "1.0",
"manifest_version": 2,
"content_scripts": [{
"matches": ["<all_urls>"],
"js": ["content_script.js"]
}],
"permissions": [
"webRequest",
"webRequestBlocking",
"<all_urls>"
]
}
content_script.js
if (window.location.hostname = "w3schools.com") {
alert("Hello");
console.log("Hi console");
}
我将此扩展程序添加到了Chrome中,但是当刷新每个页面时,我都会收到 alert 消息;
我该如何解决这个问题?
我的编码正确吗?