chrome.tabs.getCurrent(function(tab){
  alert(tab.id);
});
Is tab an object? Why doesn't it have an id property?
How can I get the id of the current tab?
chrome.tabs.getCurrent(function(tab){
  alert(tab.id);
});
Is tab an object? Why doesn't it have an id property?
How can I get the id of the current tab?
chrome.tabs.getCurrent(function(tab){ console.log(JSON.stringify(tab,null, 2)); }) gives me next
{
  "active": true,
  "audible": false,
  "favIconUrl": "chrome-extension://eggkanocgddhmamlbiijnphhppkpkmkl/img/favicon.png",
  "height": 853,
  "highlighted": true,
  "id": 5280,
  "incognito": false,
  "index": 0,
  "mutedInfo": {
    "muted": false
  },
  "pinned": false,
  "selected": true,
  "status": "complete",
  "title": "Tabs Outliner",
  "url": "chrome-extension://eggkanocgddhmamlbiijnphhppkpkmkl/activesessionview.html?type=main&focusNodeId=5220&altFocusNodeId=5046&scrollToViewWinId=5046",
  "width": 400,
  "windowId": 5279
}
List of all props you can find at https://developer.chrome.com/extensions/tabs#type-Tab --- id marked as optional
The ID of the tab. Tab IDs are unique within a browser session. Under some >circumstances a Tab may not be assigned an ID, for example when querying >foreign tabs using the sessions API, in which case a session ID may be present. >Tab ID can also be set to chrome.tabs.TAB_ID_NONE for apps and devtools >windows.
That's important if you try run code from console
Tab ID can also be set to chrome.tabs.TAB_ID_NONE for apps and devtools >windows.