TheRealJAG
TheRealJAG

Reputation: 2088

Open new tab on extension install

I have seen this in other Chrome extensions but I have failed to figure out how to do it. Here is my question.

When someone installs my extension I want to open a new tab (to my homepage).

How is this done?

I assume this is done somehow in JavaScript. I have considered setting a cookie or a LocalStorage var, but this doesn't seem very logical since those can be deleted and could cause a new tab to open.

Upvotes: 1

Views: 412

Answers (1)

Konrad Dzwinel
Konrad Dzwinel

Reputation: 37903

This should help you check if your extension was just installed:

Detect Chrome extension first run / update

This works, as you thought, using local storage variable. Variables that your extension sets are not available to other extensions so only your extension can delete them. Also, variables from local storage are preserved when browser is restarted. So you should not be concerned about variable being deleted.

To open new tab use chrome.tabs.create function from the tabs module.

Upvotes: 1

Related Questions