我是Firefox加载项TryAgain的开发者之一,它在网站加载失败时显示自定义错误页面。它本质上取代了Firefox的netError.xhtml
自定义版本。创建XUL按钮会产生“组件失败代码”
为了将netError.xhtml
内扩展代码执行JavaScript,我添加了一个XUL <command>
元素的错误页面,如下所示:
var increment_btn = doc.
createElementNS(
"http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul",
"xul:command"
);
increment_btn.setAttribute("id", "errorIncrement");
increment_btn.setAttribute("oncommand", "autoRetryThis();");
div.appendChild(increment_btn);
每当要执行autoRetryThis()
需求,我只需运行doCommand()
元素上。在我的测试机器上,这在Firefox 2.0至4.0b10下正常工作。我收到了the following problem report,但是:
Error: Component returned failure code: 0x80040111 (NS_ERROR_NOT_AVAILABLE) [nsIDOMHTMLDocument.createElementNS]
错误指向上述代码的第一行。
如果您想知道为什么我选择使用createElementNS()
创建元素,请refer to my previous question。
我会尝试此操作并提交修改后的版本,但必须经过及时的编辑过程。你能详细说明为什么这会导致问题吗? – 2011-01-30 17:09:58