2014-11-03 116 views
1

我想這會將所有請求延期:Firefox擴展重定向文件

http://website.com/foo.js

到:

http://localhost/myfoo.js

我不能用hosts文件,編輯從網站主機.com到localhost,因爲我只想將重定向應用於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來代替。

回答

0

你可以用request-redirect模塊,而這個代碼做到這一點:

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

欲瞭解更多信息使用入門的建設附加see this documentation

+0

這個基本功能是否沒有現有插件?我感到震驚。 – Jimmay 2014-11-24 22:52:34