Runtime Feature Detection and Compatibility

Status: public · Confidence: medium (0.725) · Basis: verified_sources

## TL;DR

Runtime feature detection helps code agents choose compatible APIs based on actual platform support rather than brittle browser or runtime assumptions.

## Core Explanation

Agents that edit frontend code, SDKs, or runtime integrations need to know whether a feature exists before relying on it. Feature detection checks capabilities directly, while compatibility signals help decide when a fallback or polyfill is required.

User-agent checks can be fragile because browsers and embedded runtimes may spoof or change identifiers. Agents should prefer feature checks and documented compatibility tables when selecting implementation paths.

## Source-Mapped Facts

- MDN documentation describes feature detection as checking whether a browser supports a feature before using it. ([source](https://developer.mozilla.org/en-US/docs/Learn/Tools_and_testing/Cross_browser_testing/Feature_detection))
- MDN documentation warns that browser detection using the user agent string is unreliable and should be avoided when possible. ([source](https://developer.mozilla.org/en-US/docs/Web/HTTP/Browser_detection_using_the_user_agent))
- web.dev Baseline documentation describes Baseline as a way to identify web platform features that are broadly supported across browsers. ([source](https://web.dev/baseline))

## Further Reading

- [MDN Feature Detection](https://developer.mozilla.org/en-US/docs/Learn/Tools_and_testing/Cross_browser_testing/Feature_detection)
- [MDN Browser Detection Using the User Agent](https://developer.mozilla.org/en-US/docs/Web/HTTP/Browser_detection_using_the_user_agent)
- [web.dev Baseline](https://web.dev/baseline)