Lovable Prompt
Detect the Despia native runtime environment using JavaScript user agent string checks to conditionally show platform-specific features in your application.Please follow the implementation instructions closely. The user agent string is automatically set by the Despia Native runtime environment.
- Check if
navigator.userAgentincludes “despia” to detect the native runtime - Check for “iphone” or “ipad” in the user agent for iOS detection
- Check for “android” in the user agent for Android detection
- Use conditional rendering to show appropriate UI elements
- Show native features (in-app purchases) when in Despia, or web features (Stripe) when not
This feature works in any web application - no npm package installation required!
navigator.userAgent to detect this and conditionally render platform-specific features, such as showing RevenueCat in-app purchase buttons when running natively in Despia, or Stripe checkout buttons when running in a standard web browser.
Installation
No installation required! The user agent string is automatically set by the browser/runtime environment.Usage
1. Basic Platform Detection
2. Conditional Feature Rendering
3. Platform-Specific UI
Resources
- User Agent Check:
navigator.userAgent.toLowerCase().includes('despia') - iOS Detection: Check for “iphone” or “ipad” in user agent
- Android Detection: Check for “android” in user agent
- Automatically available in all JavaScript environments
- No external packages or configuration needed
Lovable Integration
Platform detection is automatically available in all Despia-powered Lovable applications through the standard JavaScriptnavigator.userAgent API, enabling conditional rendering based on the runtime environment.
For additional support or questions about platform detection, please contact our support team at support@despia.com