Linking

Linking gives you a general interface for securely opening external URLs from JavaScript.

import { Linking } from 'react-native';

API

Static methods

canOpenURL (url) => Promise<boolean>

Returns a Promise that resolves to a boolean indicating whether the app can open the URL.

getInitialURL () => Promise<string>

Returns a Promise that resolves to the string of the URL that initially loaded the app.

openURL (url, target) => Promise<>

Try to open the given url in a secure fashion. The provided target (including undefined) will be passed as the window target, or “_blank” if no target included. The method returns a Promise object. If the url opens, the promise is resolved. If not, the promise is rejected.


Examples

Updated
Edit
React Native for WebCopyright © Nicolas Gallagher and Meta Platforms, Inc.