Redirect user to my own page on after extension installation

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
});

but above code does not work.

please help

Thanks

does not work

What exactly do you expect to happen and what

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

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.

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?

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.

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 ?

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

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.

Thank you for update.

I will try this code and update.