0
我想讓onBeforeRequest觸發器,但它不會觸發一次。onBeforeRequest不觸發:預期的'對象',但得到'數組'
的background page console顯示錯誤:
Invalid value for argument 1. Expected 'object' but got 'array'
manifest.json的:
{
"name": "Blocker",
"version": "1.0",
"description": "Blocks all websites",
"permissions": ["webRequest", "webRequestBlocking", "<all_urls>"],
"background": {
"scripts": ["background.js"]
},
"manifest_version": 2
}
background.js:
chrome.webRequest.onBeforeRequest.addListener(
function(info) {
console.log("TRIGGERED")
return {cancel: true};
},
// extraInfoSpec
["blocking"]);
我在做什麼錯還是我我只是e xBecting onBeforeRequest不應該做什麼?例如,我想到了以下幾點:
- 我輸入網址到地址欄
- 我按enter鍵
- onBeforeRequest觸發之前的網站顯示
- 用戶獲取網站被封鎖消息
是的,你是對的,我得到以下錯誤:http://prntscr.com/ef6pij – Stanko