I know there are many similar questions on SO, but I cannot seem to get it working.
I am trying to get the URL of the current tab from my Chrome extension. Hoewever, the alert(tab.url) returns "Undefined". I have added the "tabs" to my permissions in the manifest.json. Any ideas?
<html>
<head>
<script>
chrome.tabs.getSelected(null, function(tab) {
tab = tab.id;
tabUrl = tab.url;
alert(tab.url);
});
</script>
</head>