function logTopSites(topSitesArray) {
for (const topSite of topSitesArray) {
console.log(`Title: ${topSite.title}, URL: ${topSite.url}`);
}
}
function onError(error) {
console.error(error);
}
browser.topSites.get().then(logTopSites, onError);topSites.get() / notebook
topSites.get()
Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.
function logTopSites(topSitesArray) {
for (const topSite of topSitesArray) {
console.log(`Title: ${topSite.title}, URL: ${topSite.url}`);
}
}
function onError(error) {
console.error(error);
}
browser.topSites
.get({
includeBlocked: true,
onePerDomain: false,
})
.then(logTopSites, onError);