publicSuffix.isKnownSuffix()
Returns true if the hostname is a known public suffix (eTLD) in the Public Suffix List.
Syntax
js
let result = browser.publicSuffix.isKnownSuffix(hostname)
Parameters
hostname-
string. The hostname to check.
Return value
true if hostname is a known public suffix, false otherwise.
Throws an error if hostname is not a valid hostname.
Examples
Check whether a string is a known public suffix:
js
console.log(browser.publicSuffix.isKnownSuffix("com")); // true
console.log(browser.publicSuffix.isKnownSuffix("co.uk")); // true
console.log(browser.publicSuffix.isKnownSuffix("github.io")); // true
console.log(browser.publicSuffix.isKnownSuffix("example.com")); // false
console.log(browser.publicSuffix.isKnownSuffix("localhost")); // false