使用DOM文档而不是URI创建选项卡/窗口?

时间:2009-04-21 20:19:21

标签: firefox-addon xul xpcom

我有一个Web服务,需要在请求中发送特殊标头。我能够使用XMLHttpRequest和setRequestHeader()检索预期的responseXML。

现在我想创建一个包含响应文档的新选项卡(或窗口)。我希望应用默认的XMLPrettyPrint.xsl文件,当查看源代码时,我希望在查看普通的.xml文件时看到未设置样式的源。

有什么想法吗?

1 个答案:

答案 0 :(得分:1)

我最终创建了一个协议处理程序。

我没有发现记录得很好的最大伎俩是XPCOM合同ID必须以“@ 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;