当客户端搜索内容并在此请求中找到某个单词时,如果存在页面加载将被停止(搜索将被取消),如何捕获搜索请求?
更新
的manifest.json:
"background": {
"scripts": ["background.js"]
}
"permissions": [
"tabs",
"webRequest",
"webNavigation",
"management",
"http://*/*",
"https://*/*",
"*://*.google.com/",
"webRequestBlocking",
"<all_urls>"
]
}
background.js:
chrome.webRequest.onBeforeRequest.addListener(
function(details) {
return {cancel: details.url.indexOf("://salom/") != -1};
},
{ urls: ["<all_urls>"] },
["blocking"]
);
答案 0 :(得分:-1)
"background": {
"scripts": ["background.js"]
}
"permissions": [
"tabs",
"webRequest",
"webNavigation",
"management",
"http://*/*",
"https://*/*",
"*://*.google.com/",
"webRequestBlocking",
"<all_urls>"
]
}
它是明显的json和background.js是
chrome.webRequest.onBeforeRequest.addListener(
function(details) {
return {cancel: details.url.indexOf("://salom/") != -1};
},
{ urls: ["<all_urls>"] },
["blocking"]
);