UNPKG

get-apex-domain

Version:

Returns the apex domain (aka base, bare, naked, root apex, or zone apex domain) of the current web page without the use of a public suffix list. The apex domain is also the top-most domain that allows for setting cookies.

15 lines (11 loc) 290 B
import getApexDomain from "./getApexDomain"; import cookieJar from "./cookieJar"; let apexDomain; let apexDomainRetrieved; export default () => { if (!apexDomainRetrieved) { apexDomain = getApexDomain(window, cookieJar); apexDomainRetrieved = true; } return apexDomain; };