Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何在 chrome.tabs.create 之后获取新创建的选项卡 ID?如果同时创建多个选项卡会怎样?
谢谢你。
chrome.tabs.createAPI 具有回调函数,该函数返回包含object新选项卡详细信息的
chrome.tabs.create
object
chrome.tabs.create({"url":url},function(newTab) { console.log(newTab.id); });
好的,找到了解决方案
chrome.tabs.onCreated.addListener(function(tab){ alert("new tab "+tab.id); });