D
D
Darkness2019-06-15 19:39:32
Google Chrome
Darkness, 2019-06-15 19:39:32

What to specify in the manifest so that after loading the extension immediately opens a new tab?

What to specify in the manifest so that after loading the extension immediately opens a new tab?
In the manifest for extensions, I could not find the answer in Google, I will be very grateful to you!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Darkness, 2019-06-15
@AntonBrock

Found:

chrome.runtime.onInstalled.addListener(function (object) {
    chrome.tabs.create({url: "chrome://newtab"})
});

Or, for example, another page
chrome.runtime.onInstalled.addListener(function (object) {
    chrome.tabs.create({url: "http://yoursite.com/"}, function (tab) {
        console.log("New tab launched with http://yoursite.com/");
    });
});

Don't forget to include in your manifest:
"background": {
      "scripts": ["background.js"],
      "persistent": false
  }

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question