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.
If you send a message from the script, you will have access to a 'sender' object. From there, the tab ID is accessible via 'sender.tab.id'. See http://code.google.com/chrome/extensions/messaging.html for more info. You received this message because you are subscribed to the Google Groups "Chromium-extensions" group.
current tabId is the tab that user can see its content.
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);
});
ok found the solution
chrome.tabs.onCreated.addListener(function(tab){
alert("new tab "+tab.id);
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With