如何用一个FF插件中的另一个文件的内容替换一个JavaScript文件请求? [英] How to replace a javascript file request with contents from another file in a FF addon?

查看:150
本文介绍了如何用一个FF插件中的另一个文件的内容替换一个JavaScript文件请求?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找一些关于如何用另一个文件来替换特定javascript文件的请求的指南,这些文件将与Firefox插件打包在一起。

I'm looking for some guidance on how to replace requests for a specific javascript file with another file that I'll package with the Firefox addon.

推荐答案

请参阅我如何在Firefox中为所有页面元素实现一个内容转换器?(它的范围比你真正需要的更宽 - 阅读)如何使用 registerFactory 注册代理,然后可以使用备用(例如 file:/// ... -type)使用您的particualr脚本的URI调用 newChannel 时的URI。

See How can I implement a content converter in Firefox for all page elements? (its scope is much wider than what you really need -- read on) on how to use registerFactory to register a surrogate HTTP protocol handler, which can then instantiate channels with alternate (e.g. file:///...-type) URIs when newChannel is called with your particualr script's URI.

这篇关于如何用一个FF插件中的另一个文件的内容替换一个JavaScript文件请求?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆