Get openerTabId from popup of the inactive tab?

14 views
Skip to first unread message

Criss Anger

unread,
Apr 25, 2017, 4:00:52 AM4/25/17
to Chromium-Extensions-Announce
I loaded a tab with inactive, and this tab have script open popup when few seconds.

when i try to catch openerTabId from popup by chrome.tabs.onCreated . it allway show tabId of active tab.

and how to get openerTabId from real tab (inactive tab)

In background script:

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});



in test.html

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

and the result console:


tabid
: 359was created
tabid
: 361was created
this tab open from tab: 291

and i sure tabId 291 is active tab.
Reply all
Reply to author
Forward
0 new messages