2

作为标题,我无法在 Api -> Tabs... 中找到此方法... 方式和位置?谢谢'

4

3 回答 3

10

在 Chrome 16 中已被弃用。正确的方法是使用chrome.tabs.querywithactive:truelastFocusedWindow:true

// Get the current active tab in the lastly focused window
chrome.tabs.query({
    active: true,
    lastFocusedWindow: true
}, function(tabs) {
    // and use that tab to fill in out title and url
    var tab = tabs[0];
    run({
        url: tab.url,
        description: tab.title
    });
});
于 2012-02-25T14:55:47.160 回答
1

它被删除了。请改用chrome.tabs.query

于 2012-02-25T14:51:10.627 回答
1

https://developer.chrome.com/extensions/tabs#method-getSelected

这是一种已弃用的方法,但您仍然可以使用它。

chrome.tabs.getSelected(null, function(tab) {
  var url = tab.url;
});
于 2015-11-24T22:44:55.133 回答