I am new to Javascript & I want to get the ID of the currently opened tab of google chrome browser, using the console of chrome developer tools. I tried the code below, but got an exception. How do I make this work ? Do I have to learn something more just for this little thing ?
chrome.tabs.getCurrent(function(tab){ console.log(
JSON.stringify(tab,null, 2)); });
Exception:
Uncaught TypeError: Cannot read property 'getCurrent' of undefined(…)
VM1201:1 Uncaught TypeError: Cannot read property 'getCurrent' of undefined(…)
Source: Chrome how to get the current tab's id?
EDIT: These dont not work either and fail due to the same "undefined" error.