How to check if a Firefox addon is installed (on another computer)?
As part of my research on web usage, I have people install a Firefox addon to track their visits (kinda like RescueTime, but different for my research).
So I worry whether the users cheat by uninstalling the addon. Is there any way I can have the addon notify me on install/uninstall of the addon?
I know there's a bunch of workarounds for this (say, just by using another browser client). But what can I do for this very specific case?
PS - I have the same question for a Chro开发者_开发知识库me extenion that does pretty much the same thing. I assume I should start another thread to ask that question.
You can register an observer for the em-action-requested
topic: https://developer.mozilla.org/en/Observer_Notifications#Extension_Manager. This way you can get notified whenever the user chooses to uninstall your add-on. There is a number of limitations here:
- Disabled add-ons don't get notified (they aren't active). You can get notified whenever the user chooses to disable your add-on however.
- Most add-ons aren't uninstalled immediately, usually this requires a browser restart. Until that restart the user can still choose to revert his action.
- Add-ons can be uninstalled while the browser isn't running, simply by removing the corresponding directory/file. No notification will be sent then.
It might be more reliable to send a regular "I am alive" signal to your server if you want to verify that the add-on is still installed.
For Firefox 4.0 and greater you can use the new AddonManager interface. Call the addAddonListener() method to pass in your listener. Implement the methods on your listener as documented, including onUninstalling() and/or onUninstalled().
精彩评论