MDN’s new design is in Beta! A sneak peek:

Questions and answers from the newsgroups 2006 11 17

Return to mozilla-dev-extensions


(↑ top)

Can Extensions create a global shortcut key or create an icon on the system tray in Windows, and react to the user input?

As far as I know, you would need binary components.

This bug has a patch supporting tray icon from XUL on Windows:

It may be a good starting point.

I was wondering if anyone can tell me how my addin can tell if the -console flag was specified on the FF or T-Bird command line?

As far as I'm aware the only way to get a useful nsICommandLine is to implement a nsICommandLineHandler (which gets passed in a nsICommandLine from... umm, whoever has the actual thing.)

I'm looking for a proper way to tell which application an extension, compatible with more than one is running in. Simply put, "Am I Firefox or Thunderbird?"

There are a couple of ways to do this.

1. Check the value of navigator.userAgent

if ( != -1) {
       // Thunderbird specific code
} else {
       // Firefox code

2. You should use nsIXULAppInfo for that.

You could also use, which is a human-readable name for the application, such as "Firefox".

I have an extension, and I want to provide a mechanism to save off the preferences to a file, and then restore them on another machine. What's the best way of doing this?
var prefService = Components.classes[";1"].getService(Components.interfaces.nsIPrefService);
var prefs = [];
var prefArray = prefService.getChildList(str_branch_name, prefs);

You have to serialize the preferences to disk manually. And yes, extensions can perform I/O. Look here:

In my code I call Components.utils.reportError() and pass in a string. I note that in T-Bird, the string is shown in the JavaScript Console available from the Tools menu. However, in FF's ErrorConsole available from the Tools menu, I do not see any entry. Any idea what is going wrong here?

You don't have the javascript.options.showInConsole preference enabled. Or you've clicked the "Warnings" or "Messages" filter button in the Firefox JS Error Console but not Thunderbird. Make sure "Errors" or "All" is clicked instead.


(↑ top)

Document Tags and Contributors

 Contributors to this page: RichardChu
 Last updated by: RichardChu,