views:

97

answers:

1

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.

+4  A: 

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.

vladr
So replace newchannel in `var newchannel = this.savedHttpHandler.newChannel(locationURI);` when locationURI is a ga.js uri? and replace it to a channel for a local copy included with the extension?
Erik Vold
Exactly.Another option would have been to rewrite `<javascript>` nodes in the DOM, but I think that the protocol factory is simpler and more generic in this case.
vladr
Thanks this information is helping, I'll be trying it out soon.
Erik Vold