user36278
user36278

Reputation: 228

How can I open a tab with some extension information when the user installs it?

I'm trying to get Google Chrome to open a tab which contains info about the extension when it detects that it has been installed.

Here's what I have so far:

chrome.runtime.onInstalled.addListener(function(details){
    if(details.reason == "install"){
        alert('This is the first run!');
        chrome.extension.onRequest.addListener(function(request, sender) {
    chrome.tabs.update(sender.tab.id, {url: request.redirect});
});
    }else if(details.reason == "update"){
        var thisVersion = chrome.runtime.getManifest().version;
         alert('This is the update!');
    }
});

Upvotes: 3

Views: 251

Answers (1)

Weiller Jayceon
Weiller Jayceon

Reputation: 95

I use this and it works perfectly

chrome.runtime.onInstalled.addListener(function(details){
    if(details.reason == "install"){
        chrome.tabs.create({ url: chrome.extension.getURL('welcome.html')});
    }
});

Upvotes: 1

Related Questions