detect when my extension is installed, upgraded, uninstalled

632 views
Skip to first unread message

Dru Jensen

unread,
Nov 2, 2010, 1:19:52 PM11/2/10
to Chromium-extensions
I am trying to capture events for install, upgrade and uninstall.
Firefox provides this capability but I can't seem to find a way to do
this with a Chrome extension.

The chrome.management package has an onInstalled and onUninstalled
events but they do not trigger for my extension. They only trigger if
I add a new extension.

I want to add a new tab and present a thank you page, upgrade page,
and uninstall page on these events.

Daniel Wagner-Hall

unread,
Nov 2, 2010, 4:44:19 PM11/2/10
to Dru Jensen, Chromium-extensions
The standard way of doing this is to write a value to localStorage,
e.g. localStorage["version"] = 0.1

You can tell if the extension has just been installed if the value is
undefined, or if it has just been upgraded if the value is different
from expected. There currently isn't a way of doing onUninstalled,
though I think there's a bug filed for it on http://crbug.com

> --
> You received this message because you are subscribed to the Google Groups "Chromium-extensions" group.
> To post to this group, send email to chromium-...@chromium.org.
> To unsubscribe from this group, send email to chromium-extens...@chromium.org.
> For more options, visit this group at http://groups.google.com/a/chromium.org/group/chromium-extensions/?hl=en.
>
>

jkjeldgaard

unread,
Dec 8, 2010, 12:21:49 PM12/8/10
to Chromium-extensions
Using Daniel Wagner-Hall's solution I open the options page when the
extension is installed:

in background.html:

if (localStorage["version"] == undefined)
chrome.tabs.create({url: "options/index.html"});

On Nov 2, 5:19 pm, Dru Jensen <drujen...@gmail.com> wrote:
> I am trying to capture events for install, upgrade and uninstall.
> Firefox provides this capability but I can't seem to find a way to do
> this with a Chrome extension.
>
> The chrome.management package has anonInstalledand onUninstalled
Reply all
Reply to author
Forward
0 new messages