Skip to main content

browser_from_client_hints

Function browser_from_client_hints 

Source
pub fn browser_from_client_hints(s: &str) -> Option<(&str, &str)>
Expand description

The sec-ch-ua field looks something like this: “Not_A Brand”;v=“99”, “Google Chrome”;v=“109”, “Chromium”;v=“109” The order of the items are randomly shuffled.

It tries to detect the “not a brand” item and the browser engine, if it’s neither its assumed to be a browser and gets returned as such.

Returns borrowed values so callers can bound them before copying, or None if no browser is detected.