For the complete documentation index, see llms.txt. This page is also available as Markdown.

Open External URL

openURL This function is a utility that lets you open a specified URL in the device's default browser or a connected app. It internally uses React Native's Linking.openURL.

Signature

function openURL(url: string): Promise<any>;

Parameters

  • url · Required · string

    The external web address or deep link path you want to open.

Return value

  • Promise<any>

    Returns a Promise that resolves when the URL is successfully opened.

Example

Open an external website

import { openURL } from '@apps-in-toss/web-framework';

function Page() {
  const handlePress = () => {
    openURL('https://google.com');
  };

  return (
    <button onClick={handlePress}>
      Open Google website
    </button>
  );
}
import { openURL } from '@granite-js/react-native';
import { Button } from 'react-native';

function Page() {
  const handlePress = () => {
    openURL('https://google.com');
  };

  return <Button title="Open Google website" onPress={handlePress} />;
}

Open a deep link

Notes

  • If the external URL can't be opened (invalid scheme, network blocking, etc.), the Promise may be rejected.

  • In a WebView environment, a browser tab opens in a new window, and in the default app, it switches to an external app or browser.

Last updated

Was this helpful?