gpt4 book ai didi

google-chrome - 在加载前用不同的 url 替换 url

转载 作者:行者123 更新时间:2023-12-03 18:40:57 35 4
gpt4 key购买 nike

在 google chrome 扩展中,如何在加载之前用不同的 URL 替换请求 URL?

我看了chrome.webRequest我认为其中之一就是我正在寻找的,我不知道究竟是哪一个。我相信谷歌限制了某种东西,不确定这是否是其中之一。

最佳答案

我找到了一个这样做的例子:

chrome.webRequest.onBeforeRequest.addListener(
function(info) {
// Redirect the original request to a given URL.
var url = "http://site.com/image.png";
return {redirectUrl: url};
},
// filters
{
urls: [
"http://original.com/*"
],
types: ["image"]
},
// extraInfoSpec
["blocking"]);

关于google-chrome - 在加载前用不同的 url 替换 url,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13944730/

35 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com