coderholic

Ubiquity CmdUtils.injectHTML workaround

If you haven't already heard about Mozilla Ubiquity I suggest you watch the introductory video, which will explain it far better than I can.

I've been having a bit of a play around with it, and written a few small commands. The API documentation is really good, but this being early alpha software (currently v0.1.5) not everything works as expected.

For one of my commands I wanted to inject some HTML into the current webpage. Looking through the docs CmdUtils.injectHTML seemed to be exactly what I was after. Unfortunately it doesn't work, but the workaround is simple enough:

var html = 'content to inject';
var doc = CmdUtils.getDocument();
doc.body.innerHTML += html;

Hopefully this will be fixed in the next release.

Posted on 29 Jan 2009
If you enjoyed reading this post you might want to follow @coderholic on twitter or browse though the full blog archive.