Skip to content

Avatars

Favicons_

Fetch favicons from remote websites for link previews and bookmark displays.

1 min read

Raw

The favicon endpoint retrieves favicons from remote websites. This is useful for displaying website icons in link previews, bookmarks, and social sharing interfaces.

Get favicon

Retrieve a favicon from a remote website URL.

import { Client, Avatars } from "appwrite";
const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1')
.setProject('<PROJECT_ID>');
const avatars = new Avatars(client);
const result = avatars.getFavicon({
url: 'https://example.com'
});
console.log(result); // Resource URL

Parameters

The getFavicon method accepts the following parameters:

ParameterTypeDescription
urlstringThe URL of the website to fetch the favicon from. Must be a valid HTTP or HTTPS URL.

Favicon retrieval

The service automatically attempts to retrieve favicons from common locations on the target website, including standard favicon paths and HTML meta tags.

// Standard website
const exampleFavicon = avatars.getFavicon({
url: 'https://example.com'
});
// Website with subdomain
const subdomainFavicon = avatars.getFavicon({
url: 'https://blog.example.com'
});
// Website with path
const pathFavicon = avatars.getFavicon({
url: 'https://example.com/page'
});

Use cases

Favicons are commonly used for:

  • Link previews: Display website icons in link preview cards and social sharing
  • Bookmarks: Show website icons in bookmark lists and collections
  • Referral tracking: Display source website icons in analytics and referral reports
  • Content aggregation: Show website icons in RSS feed readers and content aggregators
  • Social media: Display website icons in social media link previews and embeds

Was this page helpful?

Share what worked or what we should fix. Once approved, our agents automatically apply suggested updates to the docs.