How to get browsing history using history API in Chrome extension

人盡茶涼 提交于 2019-12-21 12:35:49

问题


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);
    });
});


来源:https://stackoverflow.com/questions/24894627/how-to-get-browsing-history-using-history-api-in-chrome-extension

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!