I am testing my Chrome extension by using the following codes:
chrome.tabs.create({url: "login_popup.html"}, function(tab){
chrome.extension.sendRequest({oid: tab.openerTabId});
});
However, a new tab was created only when Chrome started, but no tabs were created when I opened open a new page. Shouldn’t the chrome.tabs.create be executed whenever a new page is loaded?
The manifest.json is:
{
"name": "minus_test",
"version": "1.0",
"background_page": "minus_test.html",
"permissions": [ "*://*/", "tabs" ]
}
Thanks!
No.
background_pagegets executed once when Chrome starts at which point it creates a new tab. If you want to create a new tab ever time a new window is opened you need to use the chrome.windows.onCreated listener.