history.getVisits()
Ruft Informationen über alle Besuche der angegebenen URL ab.
Dies ist eine asynchrone Funktion, die ein Promise
zurückgibt.
Syntax
let getting = browser.history.getVisits(
details // object
)
Parameter
Rückgabewert
Ein Promise
wird mit einem Array von
Objekten erfüllt, die jeweils einen Besuch der angegebenen URL repräsentieren. Die Besuche sind in umgekehrt chronologischer Reihenfolge sortiert.history.VisitItem
Browser-Kompatibilität
Report problems with this compatibility data on GitHubdesktop | mobile | ||||||
---|---|---|---|---|---|---|---|
getVisits |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
- No support
- No support
Beispiele
Liste alle Besuche der zuletzt besuchten Seite auf:
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);
Hinweis:
Diese API basiert auf der chrome.history
API von Chromium. Diese Dokumentation ist aus history.json
im Chromium-Code abgeleitet.