1
我想爲Chrome編寫一個擴展程序來觀看我的XHR調用,並且發現我必須爲此使用webRequest。Javascript - Chrome擴展程序 - Webrequest - Responsebody
我想獲得請求的響應主體,但我從來沒有找到如何做到這一點。這可能嗎?
// chrome.browserAction.onClicked.addListener(function (tab) {
var callback = function(details) {
var url = details.url;
console.log(details);
};
var filter = {
urls: ["*://safan.dev/*"]
};
var ops = ["requestBody"];
chrome.webRequest.onBeforeRequest.addListener(
callback, filter, ops
);
// });
和清單:
{
"manifest_version": 2,
"name": "Forge of Empires",
"description": "FOE",
"version": "1.0",
"browser_action": {
"default_icon": "icon.png"
},
"permissions": [
"webRequest",
"<all_urls>"
],
"background": {
"scripts": ["logic.js"]
}
}