views:

123

answers:

1

I have a web service that requires special headers to be sent in the request. I am able to retrieve expected responseXMLs using an XMLHttpRequest and setRequestHeader().

Now I would like to create a new tab (or window) containing the response document. I would like the default XMLPrettyPrint.xsl file applied to it and when the source is viewed, I'd like to see the un-styled source as when viewing a normal .xml file.

Any ideas?

A: 

I ended up creating a protocol handler.

The biggest trick that I didn't find to be documented well was the fact that the XPCOM contract ID must start with "@mozilla.org/network/protocol;1?name=". E.g.,:

/* as in foo:// . This is called the scheme. */
var thisIsWhatMyProtocolStartsWith = "foo"; 
var contractID = "@mozilla.org/network/protocol;1?name=" + thisIsWhatMyProtocolStartsWith;
steamer25