Google chrome extension 如何从非活动选项卡获取OpenerTab

Google chrome extension 如何从非活动选项卡获取OpenerTab,google-chrome-extension,Google Chrome Extension,我加载了一个不活动的选项卡,这个选项卡在几秒钟后会弹出脚本 当我试图通过chrome.tabs.onCreated从弹出窗口捕获openerTabId时。它始终显示活动选项卡的tabId 以及如何从real选项卡(非活动选项卡)获取OpenerTab 在后台脚本中: chrome.tabs.onCreated.addListener((tab)=>{ console.log("tabid: "+tab.id+ "was created"); if(typeof tab.op

我加载了一个不活动的选项卡,这个选项卡在几秒钟后会弹出脚本

当我试图通过
chrome.tabs.onCreated
从弹出窗口捕获
openerTabId
时。它始终显示活动选项卡的
tabId

以及如何从real选项卡(非活动选项卡)获取
OpenerTab

在后台脚本中:

chrome.tabs.onCreated.addListener((tab)=>{
    console.log("tabid: "+tab.id+ "was created");
    if(typeof tab.openerTabId != "undefined") console.log("this tab open from tab: "+tab.openerTabId);
});

chrome.tabs.create({url:'http://localhost/test/test.html',active:false});
test.html中

<script type="text/javascript">
    setTimeout(function(){
        window.open("https://google.com.vn");
    },3000);
</script>

我确信tabId 291是活动的选项卡。

请显示您的代码。@Deliaz我创建了我的代码。
窗口是可能的。open
不会设置真正的OpenerTab。@wOxxOm但是,如果此选项卡活动,它提供真实的openerTabId您可能希望看到这个,看看它是否对您有帮助。请显示您的代码。@Deliaz我创建了我的代码它可能是
窗口。open
不会设置真实的openerTabId。@wOxxOm但是,如果此选项卡处于活动状态,它提供真实的openerTabId您可能希望看到这个,看看它是否对您有帮助。
tabid: 359was created
tabid: 361was created
this tab open from tab: 291