I'm one of the developers of TryAgain, a Firefox add-on, that displays a custom error page when a website fails to load. It essentially replaces Firefox's netError.xhtml
with a customized version.
However, I've run in to some fairly terminal compatibility problems between 3.0.*-3.6.* and Fx4b5. (An entry in netError.dtd has been renamed, causing a XML parse error in either one version or the other.)
To fix this, I've decided to have the extension dynamically modify the page, opposed to replacing it completely. One of the elements I need to add to netError.xhtml
in Fx3 is a <xul:button>
. However, by adding it with the following code, nothing appears on the screen:
var div = document.getElementById("errorContent");
var btn = document.createElement("xul:button");
btn.setAttribute("label", "Hello world");
btn.setAttribute("oncommand", "alert('Hello world!');");
div.appendChild(btn);
I see that on the Mozilla Developer Center that there is this note:
Gecko implementation of createElement doesn't conform to the DOM spec for XUL and XHTML documents: localName and namespaceURI are not set to null on the created element. See bug 280692 for details.
What does this entail, and how can I resolve it?
Furthermore, how can I execute the oncommand
event through JavaScript?