var windows = chrome.windows.getCurrent(
function(windows){
try{
// dont really know why this is null. it should be a list of tabs.
if(windows.tabs == null)
alert(windows.type + " " + windows.id);
}
catch(e){
alert(e);
}
});
I am using this code to get all the open tabs in the current window. But the window.tabs is always null even though there are tabs open in the current window. Is there something wrong with the concept of current window.
Could anyone please explain what is it that i am doing wrong.
Thanks.
Looks like the
windowsobject that gets passed to your callback doesn’t have atabsfield. Try this code instead:Also ensure that you have the
tabspermission. I also ran this on a background page, so if you’re not running it on a background page, you should make surechrome.tabsis available in your context.