Google chrome extension 通过chrome扩展重定向url时传递标题

Google chrome extension 通过chrome扩展重定向url时传递标题,google-chrome-extension,google-chrome-devtools,Google Chrome Extension,Google Chrome Devtools,我想在从chrome扩展重定向URL时传递标题和正文 function (details) { if (details.type == "xmlhttprequest") { let index = details.url.indexOf(".com"); let redirect = "http://localhost:9010" + details.url.substring(index + 4) chrome.extension.getBa

我想在从chrome扩展重定向URL时传递标题和正文

  function (details) {

    if (details.type == "xmlhttprequest") {
      let index = details.url.indexOf(".com");
      let redirect = "http://localhost:9010" + details.url.substring(index + 4)
      chrome.extension.getBackgroundPage().console.log(redirect);
      return { redirectUrl: redirect };
    }

  }, { urls: ["<all_urls>"] },
  ["blocking"]
);

功能(详细信息){
if(details.type==“xmlhttprequest”){
让index=details.url.indexOf(“.com”);
让重定向=”http://localhost:9010“+details.url.substring(索引+4)
chrome.extension.getBackgroundPage().console.log(重定向);
返回{redirectUrl:redirect};
}
},{URL:[“”]},
[“封锁”]
);
正如您在返回
重定向URL
和标题中看到的,只有在一个事件中才能返回:onHeadersReceived。在所有其他情况下,您需要使用额外的事件侦听器来更改标题。正如您在返回
重定向URL
和标题中所看到的,只有在一个事件中才能使用:onHeadersReceived。在所有其他情况下,您需要使用额外的事件侦听器来更改头。