Get current page URL in Chrome extension
问题 I want to get the current page URL from my default_popup page like this: chrome.tabs.query({active:true},function(tab){ url = tab.url; }); And I have registered this popup.html page in the manifest.json file. Yet I am getting the error message: Uncaught Type Error: Cannot call method 'query' of undefined What am I doing wrong? 回答1: The callback parameter should specify a function that looks like this: function(array of Tab result){...} Maybe you should write like this url = tab[0].url; 回答2: