Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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!');
    }
});
like image 978
user36278 Avatar asked Nov 22 '25 17:11

user36278


1 Answers

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')});
    }
});
like image 182
Weiller Jayceon Avatar answered Nov 25 '25 09:11

Weiller Jayceon