# Redirect user to my own page on after extension installation

**URL:** <https://discourse.mozilla.org/t/redirect-user-to-my-own-page-on-after-extension-installation/13380>\
**Category:** Development\
**Created:** [February 3, 2017, 12:46pm UTC](https://discourse.mozilla.org/t/redirect-user-to-my-own-page-on-after-extension-installation/13380 "2017-02-03T12:46:02Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![dinesh1](https://avatars.discourse-cdn.com/v4/letter/d/7bcc69/32.png) [@dinesh1](https://discourse.mozilla.org/u/dinesh1)\
**Post date:** [February 3, 2017, 12:46pm UTC](https://discourse.mozilla.org/t/redirect-user-to-my-own-page-on-after-extension-installation/13380/1 "2017-02-03T12:46:02Z")

</div>

Hello,

I have developed the Firefox extension. and want to redirect to user to my page on extension installation. use following code in background script :-  
browser.runtime.onInstalled.addListener(function(details){  
console.log(details):  
chrome.tabs.create({  
url : “[https://xyz.com](https://xyz.com)”  
});

but above code does not work.

please help

Thanks

---

<div class="post-metadata">

**Author:** ![NilkasG](https://avatars.discourse-cdn.com/v4/letter/n/0ea827/32.png) [@NilkasG](https://discourse.mozilla.org/u/NilkasG)\
**Post date:** [February 3, 2017, 1:03pm UTC](https://discourse.mozilla.org/t/redirect-user-to-my-own-page-on-after-extension-installation/13380/2 "2017-02-03T13:03:25Z")

</div>

> does not work

What **exactly** do you expect to happen and what

---

<div class="post-metadata">

**Author:** ![dinesh1](https://avatars.discourse-cdn.com/v4/letter/d/7bcc69/32.png) [@dinesh1](https://discourse.mozilla.org/u/dinesh1)\
**Post date:** [February 3, 2017, 1:45pm UTC](https://discourse.mozilla.org/t/redirect-user-to-my-own-page-on-after-extension-installation/13380/3 "2017-02-03T13:45:26Z")

</div>

we want to open new tab where we will redirect the user to our page on extension installation. and track the extension installation. so how to find installation event.  
Thanks

---

<div class="post-metadata">

**Author:** ![NilkasG](https://avatars.discourse-cdn.com/v4/letter/n/0ea827/32.png) [@NilkasG](https://discourse.mozilla.org/u/NilkasG)\
**Post date:** [February 3, 2017, 1:50pm UTC](https://discourse.mozilla.org/t/redirect-user-to-my-own-page-on-after-extension-installation/13380/4 "2017-02-03T13:50:49Z")

</div>

Damn, there was an error when I replied an the more important question was cut of -.-

“What exactly do you expect to happen and what […]” **happens instead**?

There is bound to be an error message or something somewhere.

---

<div class="post-metadata">

**Author:** ![dinesh1](https://avatars.discourse-cdn.com/v4/letter/d/7bcc69/32.png) [@dinesh1](https://discourse.mozilla.org/u/dinesh1)\
**Post date:** [February 4, 2017, 5:50am UTC](https://discourse.mozilla.org/t/redirect-user-to-my-own-page-on-after-extension-installation/13380/5 "2017-02-04T05:50:06Z")

</div>

I want to track my extension installation. for tracking extension installation i will redirect user to my website thank you page after extension installed where will track that page. so I have used above code but that fail to redirect.

now i do not find any error or message on above code.  
How to track the extension installation?

---

<div class="post-metadata">

**Author:** ![NilkasG](https://avatars.discourse-cdn.com/v4/letter/n/0ea827/32.png) [@NilkasG](https://discourse.mozilla.org/u/NilkasG)\
**Post date:** [February 4, 2017, 4:03pm UTC](https://discourse.mozilla.org/t/redirect-user-to-my-own-page-on-after-extension-installation/13380/6 "2017-02-04T16:03:12Z")

</div>

> [@dinesh1](#):
>
> for tracking extension installation

If that is the only reason, I think you should just send an XHR request. To do that (and maybe also to open a tab with your url) you probably need to add a host permission (something like `"https://your.domin.tld/*"`) to the manifest.

> now i do not find any error or message on above code.  
> How to track the extension installation?

Go to `about:debugging` and open the Add-on Debugger. Then reload the extension.

---

<div class="post-metadata">

**Author:** ![dinesh1](https://avatars.discourse-cdn.com/v4/letter/d/7bcc69/32.png) [@dinesh1](https://discourse.mozilla.org/u/dinesh1)\
**Post date:** [March 1, 2017, 6:57am UTC](https://discourse.mozilla.org/t/redirect-user-to-my-own-page-on-after-extension-installation/13380/7 "2017-03-01T06:57:16Z")

</div>

Hello,

I have check and try every thing but i do not find any event after extension install.

Please elaborate in details :- How to redirect the user to new tab(thanks page) on extension installation success ?

---

<div class="post-metadata">

**Author:** ![NilkasG](https://avatars.discourse-cdn.com/v4/letter/n/0ea827/32.png) [@NilkasG](https://discourse.mozilla.org/u/NilkasG)\
**Post date:** [March 1, 2017, 5:01pm UTC](https://discourse.mozilla.org/t/redirect-user-to-my-own-page-on-after-extension-installation/13380/8 "2017-03-01T17:01:15Z")

</div>

In Firefox 52+ and the current Chrome and Opera, this should work:

```auto
browser.runtime.onInstalled.addListener(async ({ reason, }) => {
    if (reson !== 'install') { return; }
    const tab = (await browser.tabs.create({
        url: 'https://your.extension.domain/installed/?v='+ browser.runtime.getManifest().version,
        active: true,
    }));
    (await Windows.update(tab.windowId, { focused: true, }));
    console.log('Opend tab and focused its window');
});

```

You may have to add some permissions for this.

**Edit** : to make this work in Chrome and Opera, you would need to polyfill a Promise based `brouwser.*` API.

---

<div class="post-metadata">

**Author:** ![dinesh1](https://avatars.discourse-cdn.com/v4/letter/d/7bcc69/32.png) [@dinesh1](https://discourse.mozilla.org/u/dinesh1)\
**Post date:** [March 2, 2017, 4:51am UTC](https://discourse.mozilla.org/t/redirect-user-to-my-own-page-on-after-extension-installation/13380/9 "2017-03-02T04:51:51Z")

</div>

Thank you for update.

I will try this code and update.
