How to replace a javascript file request with contents from another file in a FF addon?

梦想的初衷 提交于 2019-12-12 07:38:32

问题


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.


回答1:


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.



来源:https://stackoverflow.com/questions/3122854/how-to-replace-a-javascript-file-request-with-contents-from-another-file-in-a-ff

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!