google chrome extension get new tab ID

Viewed 4696

how can i get the new created tab ID after chrome.tabs.create? and what if it was more that one tab create in the same time?

thank you.

2 Answers

The chrome.tabs.create API has the callback function that returns an object containing the new tab details

chrome.tabs.create({"url":url},function(newTab) {
console.log(newTab.id);
});
Related