this works fine
var tabUrl;
chrome.tabs.query({active: true, currentWindow: true}, function(tabs) {
tabUrl = tabs[0].url;
console.log(tabUrl);
});
but this show undefined
var tabUrl;
chrome.tabs.query({active: true, currentWindow: true}, function(tabs) {
tabUrl = tabs[0].url;
});
console.log(tabUrl);
However I want to check URL to change my popup.html according to the page that user is browsing but I don't want to do this all inside chrome.tabs.query function