Search.../

openUrl( )

Directs the mobile app to open the specified URL in the device's browser.

Description

developer preview tag

The openUrl() function returns a Promise that resolves when the navigation is successful.

Supported URL formats:

  • An external web address. For example, http(s)://<my-website>.
  • A URI such as a phone number, geographic coordinates, social media link, or email. For example, mailto:<address>@<someplace.com>?subject=<subject>.

Syntax

function openUrl(url: string): Promise<void>

openUrl Parameters

NAME
TYPE
DESCRIPTION
url
string

The URL to open.

Returns

Fulfilled - When the navaigation is successful.

Return Type:

Promise<void>

Was this helpful?

Open a URL in the device's browser

Copy Code
1import wixNavigateMobile from 'wix-navigate-mobile';
2
3/* Sample url value: 'https://wa.me/15551234567?text=I%27m%20interested%20in%20your%20car%20for%20sale'*/
4
5wixNavigateMobile.openURL(url)
6 .then(() => {
7 console.log('URL opened successfully!');
8 return;
9 })
10 .catch((error) => {
11 console.error(error);
12 // Handle the error
13});
14
15/* Promise resolves to void */