function gotVisits(visits) {
console.log(`Visit count: ${visits.length}`);
for (const visit of visits) {
console.log(visit.visitTime);
}
}
function listVisits(historyItems) {
if (historyItems.length) {
console.log(`URL ${historyItems[0].url}`);
const gettingVisits = browser.history.getVisits({
url: historyItems[0].url,
});
gettingVisits.then(gotVisits);
}
}
let searching = browser.history.search({
text: "",
startTime: 0,
maxResults: 1,
});
searching.then(listVisits);history.getVisits() / notebook
history.getVisits()
Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.