:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
import { polyfillCountryFlagEmojis } from 'country-flag-emoji-polyfill'
// The package defaults its font URL to cdn.jsdelivr.net. We serve the file ourselves so that an open
// CDN stays out of the app's `font-src`: there it is both a wider font-parser surface and exactly the
// remote origin a CSS-injection exfiltration needs. Call this instead of the package, so a new call
// site cannot reintroduce the default.
//
// The family name has to match the `font-family` our CSS declares for flag glyphs.
const FONT_FAMILY = 'Emoji Flags Polyfill'
const FONT_URL = '/static/fonts/TwemojiCountryFlags.woff2'
export function polyfillCountryFlags(): boolean {
return polyfillCountryFlagEmojis(FONT_FAMILY, FONT_URL)
}