0
這工作得很好如何使用標籤的網址外chrome.tabs.query
var tabUrl;
chrome.tabs.query({active: true, currentWindow: true}, function(tabs) {
tabUrl = tabs[0].url;
console.log(tabUrl);
});
,但這個節目未定義
var tabUrl;
chrome.tabs.query({active: true, currentWindow: true}, function(tabs) {
tabUrl = tabs[0].url;
});
console.log(tabUrl);
但是我要檢查URL根據改變我popup.html用戶正在瀏覽的頁面,但我不想在chrome.tabs.query函數中執行此操作。
審查異步概念[這裏](http://stackoverflow.com/questions/14220321/how-do-i-return-the-response-from-an-asynchronous -all) –
非常感謝你@IvánNokonoko – spyagentsss