navigator.userAgent to detect this and conditionally render platform-specific features.
Installation
- Bundle
- CDN
How it works
The Despia runtime injects “despia” into the user agent string alongside the standard platform identifiers. A simple substring check tells you which environment your code is running in.Conditional payment flow
Show an in-app purchase button inside Despia and a web checkout flow in the browser. This is the standard pattern for hybrid apps that ship to both the App Store and the web, since native stores require their own billing for digital goods.Platform-specific UI
Render different layouts or copy depending on which platform the user is on. Useful for store review compliance, where iOS and Android have different policy requirements around external links and payment language.SSR safety
navigator is undefined during server-side rendering in frameworks like Next.js or Remix. Guard the check with a typeof test or run it inside useEffect so it executes on the client only.
Resources
NPM Package
despia-native