Tabs.url is undefined
- by Notionwork
I have no clue what I'm doing wrong here! This should be working I believe. I'm writing a chrome extension and this should get the current tab's url and set the html of #current-tab to the url (for testing purposes). The code successfully gets to the callback, but it says that tab.url is undefined when I put it in an alert box, and it does not put it's value in #current-tab. Here's the code I have:
$('#get-tab').click(function(){
chrome.tabs.query({"active" : true}, function(tab){
for (var i = 0; i < tab.length; i++) {
alert(tab.url);
$('#current-tab').append(tab.url);
};
});
});