1. 程式人生 > >chrome.tabs.getCurrent 返回 tab 是undefined?

chrome.tabs.getCurrent 返回 tab 是undefined?

使用getCurrent返回undefined?

    chrome.tabs.getCurrent(function(tab){
        console.log(tab);
    });

換如下的兩個試試~~

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

    chrome.tabs.query({ currentWindow: true, active: true }, function (tabs) {
      console.log(tabs[0
]); });