gpt4 book ai didi

用于重定向文件的 Firefox 扩展

转载 作者:行者123 更新时间:2023-12-05 07:57:34 34 4
gpt4 key购买 nike

我想要一个重定向所有请求的扩展:

http://website.com/foo.js

到:

http://localhost/myfoo.js

我无法使用主机文件将主机从 website.com 编辑为本地主机,因为我只想将重定向应用于 foo.js。

我试过使用这个扩展:

https://addons.mozilla.org/en-US/firefox/addon/redirector/

但它只有在您在地址栏中键入 http://website.com/foo.js 时才有效,我希望它将任何想要访问此链接的内容重定向到我的本地主机版本。

例如,如果 http://website.com/bar.html 使用 http://website.com/foo.js 那么我希望它使用http://localhost/myfoo.js 代替。

最佳答案

您可以使用 request-redirect 来做到这一点模块和这段代码:

let { Redirect } = require("request-redirect");
Redirect({ from: "http://website.com/foo.js", to: "http://localhost/myfoo.js" });

有关开始构建附加组件的更多信息 see this documentation .

关于用于重定向文件的 Firefox 扩展,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26720504/

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