how to get current tabId from background page

后端 未结 4 1092
轮回少年
轮回少年 2020-12-14 15:02

how to get current tabId from background page? current tabId is the tab that user can see its content.

background.html



             


        
4条回答
  •  被撕碎了的回忆
    2020-12-14 15:33

    Many API methods interpret null as a current tab. chrome.tabs.sendRequest is one of them.

    Otherwise:

    chrome.tabs.getSelected(null, function(tab) { ... })
    

提交回复
热议问题