【发布时间】:2018-08-21 14:40:50
【问题描述】:
我需要捕获一个 http 重定向(以防止网站上出现重定向循环)。我尝试使用 webRequest API (onBeforeRedirect),但它似乎没有捕捉到重定向。
这是我的 manifest.json:
{
"manifest_version": 2,
"name": "name",
"description": "description",
"version": "1.0",
"permissions": [
"<all_urls>","webRequest","webRequestBlocking"
],
"background": {
"scripts": ["test.js"],
"persistent": true
}
}
这是我的 test.js:
var callback = function(details) {
console.log("redirect caught!");
};
chrome.webRequest.onBeforeRedirect.addListener(callback);
我做错了什么?
【问题讨论】:
标签: javascript google-chrome google-chrome-extension http-redirect