PhoenixKit.Utils.UserAgent (phoenix_kit v1.7.208)

Copy Markdown View Source

Deliberately small, allocation-light User-Agent sniffing.

Enough to make a device recognisable in UI/email copy ("Chrome on macOS"), not a UA-parsing library. Shared by the QR login confirm screen and the new-login security alert.

Summary

Functions

Best-effort browser name from a raw User-Agent string.

Best-effort OS name from a raw User-Agent string.

Functions

browser(ua)

@spec browser(String.t() | nil) :: String.t() | nil

Best-effort browser name from a raw User-Agent string.

Returns nil for nil input or an unrecognized string.

os(ua)

@spec os(String.t() | nil) :: String.t() | nil

Best-effort OS name from a raw User-Agent string.

Returns nil for nil input or an unrecognized string.