1

I am developing a Firefox extension and I need to open a new tab when a user install the add-on.

I found a solution in here Opening my page in firefox after installing the addon using preferences. It does work but the problem is after removing extension and installing it again I still need to have that new tab and it's not working with preference because i found no solution to delete it.

There are some extensions like StumbleUpon which do the same thing .

So the question is :

        Is there another way to detect installation of add-on?

Thanks

Community
  • 1
  • 1
codedme
  • 616
  • 3
  • 12

1 Answers1

0

Why don't you use the preference value to show the new install tab at first run, then you change the preference to false, and if you uninstall it, instead of trying to delete it, you just set it to true again. This way if you re install you'll show it again.

See for reference Install and Uninstall Scripts

Filipe Silva
  • 21,189
  • 5
  • 53
  • 68
  • Because i can't access preference with an uninstalled extension.http://stackoverflow.com/questions/6284051/in-my-firefox-extension-onuninstalled-event-doesnt-seem-to-fire – codedme Jul 11 '13 at 23:41
  • @codedme. That answer says exactly what you have to do if you are using the addon-sdk and if you aren't. If you aren't, use the onUninstalling event to set the preference value back to the one you want it on re installing. That might not be perfect, but would be close. I don't know another way of doing it. – Filipe Silva Jul 12 '13 at 09:12
  • Thanks for your answer and comment that would be perfect if i could use onUnistalling event but as it's mentioned in link that i gave you firefox doesn't communicate with uninstalled extension .If you are sure about this please can you give me a code to for example alert something on uninstallation. – codedme Jul 12 '13 at 23:21
  • I know this can be done with Bootstrapped extensions but it is really exhausting to change the whole code! – codedme Jul 12 '13 at 23:23
  • The idea is not to communicate after uninstalling, but when the user clicks to uninstall. The issue with xul based extensions is that the user can cancel the uninstall process, but you may be able to work around that too. There is a code sample here: [uninstall code sample](https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/Add-on_Manager/Code_Samples#Listening_for_addon_uninstall) – Filipe Silva Jul 13 '13 at 18:07