I am trying to get the url of tab which is currently there and it should change as soon as I change my tab.My code is this:
var y;
chrome.tabs.getSelected(null, function(tab) {
alert("current:"+tab.url);
y=tab.url;
});
The problem is it only gives the Url of the first page when I load the extension i.e chrome://extensions and doesn't change its value when I change the tabs .I know I am doing something wrong .I am new to this and probably not able to understand it properly.What to do?