Browser
Browser and platform detection for web applications.
Browser contexts use these attributes:
| Attribute | Type | Source | Example | Private | Notes |
|---|---|---|---|---|---|
| key | String | Composite | chrome-120.0.6099.109 | FALSE | Browser Identifier + Version String |
| userAgent | String | Navigator API | Mozilla/5.0… | FALSE | Browser’s user-agent string |
| appName | String | Browser Detection | Chrome | FALSE | Browser app name (Firefox, Safari, Chrome) |
| /app/firefox/version | String | Browser Detection | 121.0 | FALSE | Firefox version |
| /app/chrome/version | String | Browser Detection | 120.0.6099.109 | FALSE | Chrome version |
| /app/safari/version | String | Browser Detection | 17.2 | FALSE | Safari version |
| /locale/tag | String | Navigator API | en | FALSE | Language code (en, es, de) |
Implementation example
Implement a browser context like this:
const browserContext = {
kind: "browser",
key: `${browserName}-${browserVersion}`,
userAgent: navigator.userAgent,
appName: browserName,
app: {
[browserName.toLowerCase()]: {
version: browserVersion
}
},
locale: {
tag: navigator.language.split('-')[0]
}
};
Use cases
Roll out by browser to reduce browser-specific issues
Use this when you start a rollout on browsers where you have strong test coverage. For example, roll out to Chrome at 20% while Safari remains at 5% until you verify compatibility.
Progressive enhancement based on browser capabilities
Use this when you enable features that require modern browser APIs. For example, enable WebGL-based visualizations only in browsers that support it. You can also use Service Workers only in compatible browsers.
Browser version targeting
Use this when your features require minimum browser versions. For example, enable features that use CSS Grid only on browsers with full Grid support. Use modern JavaScript features only on browsers with ES2020+ support.
Localization testing
Use this when you roll out internationalization features. For example, enable new translations for users with specific locale settings. You can also test RTL layout for Arabic or Hebrew language users.