Reputation: 228
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
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