MDN self-hosted library · e01.org

publicSuffix

Use the publicSuffix API to work with domain names and public suffixes (effective top-level domains, or eTLDs) from the Public Suffix List. Because the browser's built-in Public Suffix List is always up to date, extensions don't need to bundle a copy.

no runnable cells webextension-api upstream source

Use the publicSuffix API to work with domain names and public suffixes (effective top-level domains, or eTLDs) from the Public Suffix List. Because the browser's built-in Public Suffix List is always up to date, extensions don't need to bundle a copy.

Common use cases include:

  • Identifying the registrable domain (eTLD+1) of a hostname to group related domains or detect third-party requests.
  • Checking whether a hostname is itself a public suffix.
  • Extracting the public suffix portion of a hostname.

To use this API, you must have the "publicSuffix" permission.

Types

  • publicSuffix.DomainEncoding
  • : Specifies the encoding format for domain names returned by publicSuffix.getDomain().

Functions

  • publicSuffix.isKnownSuffix()
  • : Returns true if the hostname is a known public suffix.
  • publicSuffix.getKnownSuffix()
  • : Returns the known public suffix of a hostname, or null if none exists.
  • publicSuffix.getDomain()
  • : Returns the registrable domain (eTLD+1) of a hostname.

h2

Browser compatibility