trigger scripts for mozilla xpi packages

I’ve been doing some development recently on the Mozilla XPCOM platform, and it’s pretty cool. However, I ran into a small snag when I tried to install an XPI package. I built. The package itself built fine, but Mozilla just ignored me when I tried to use their trigger script in a web page:

<a href="#" onclick="InstallTrigger.installChrome(
   InstallTrigger.COMPONENT, 'mypackage.xpi',

After some poking around, I found that if you just link to the XPI file directly, it works:

<a href="/mypackage.xpi"> Install! </a>

While you’re developing, you can use the shortcut of typing the file:// link, e.g. file:///home/ryanb/mypackage.xpi, directly into the Mozilla URL box.

Happy packaging!

Leave a Reply

Your email address will not be published. Required fields are marked *