GO-Ve01
ServicesDevelopersBooksDictionaryPapersWikidataEncyclopediaSearchBabelCareersDeck

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.

Use the `publicSuffix` API to work with domain names and public suffixes (effective top-level domains, or eTLDs) from the [Public Suffix List](https://publicsuffix.org/). 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](/docs/Mozilla/Add-ons/WebExtensions/manifest.json/permissions).

## 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

source: MDN Web Docs mirror · page

Cite this

"publicSuffix". MDN Web Docs. CC BY-SA 2.5 (MDN). https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/publicSuffix

JSON record · API collection · BibTeX · RIS · CSL-JSON · citation policy

Save to pass ·