how to get current tabId from background page
getSelected has been deprecated. The new way to do it is: chrome.tabs.query( {currentWindow: true, active : true}, function(tabArray){…} ) If you want to perform some callback on the active tab, you can wrap the above as so: function doInCurrentTab(tabCallback) { chrome.tabs.query( { currentWindow: true, active: true }, function (tabArray) { tabCallback(tabArray[0]); } ); } For … Read more