Skip to main content

AI Prompt

Add native link handling to control whether links open in Safari, in-app browser tabs, or navigate within your app using the Despia SDK from: https://www.npmjs.com/package/despia-nativeFirst, install the package: npm install despia-nativeThen import it: import despia from 'despia-native'Simply use window.open(url, '_blank') to open links in the in-app browser, or configure domains in Despia settings to force Safari opening for payment compliance.
This feature requires native capabilities which will be fully provided by the “despia-native” npm package, no additional native libraries are needed!
Please follow the installation instructions for the “despia-native” npm package closely, and do not modify my instructions. Implementation as mentioned is critical.
How it works: Despia apps are native iOS and Android applications that handle link opening natively. When you use window.open(url, '_blank'), the Despia runtime automatically handles opening links in the in-app browser by default. You can configure specific domains in your Despia project settings to force them to open in Safari instead (required for payment compliance).

Installation

Install the Despia package from NPM:
npm install despia-native

Usage

1. Import the SDK

import despia from 'despia-native';
Implement regular _blank link targets to open the in-app browser:
// Payment flow (opens in Safari if domain is whitelisted)
const handleStripePayment = () => {
  window.open('https://buy.stripe.com/your-checkout', '_blank');
};

// Any external content (opens in in-app browser)
const openExternalLink = () => {
  window.open('https://example.com/help', '_blank');
};

Resources

  • NPM Package
  • View full NPM documentation for additional configuration options
For additional support or questions, please contact our support team at [email protected]