How can I get the URLs of recently visited tabs using chrome.history API, specifically, the last 10 URLs visited?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
Pass an empty string as your query to the search() method of the chrome.history API. For example, this will log the 10 most recently visited URLs to the console:
chrome.history.search({text: '', maxResults: 10}, function(data) {
data.forEach(function(page) {
console.log(page.url);
});
});