I am trying to get the current tab url in chrome extension as per this answer. But the value of url remains always undefined. What could be the reason?
EDIT
Here is my code
chrome.tabs.query({'active': true, 'lastFocusedWindow': true}, function (tabs) {
var url = tabs[0].url;
});
I have defined the tabs permission in my manifest file