Directs the mobile app to open the specified URL in the device's browser.
The openURL()
function returns a Promise that resolves when the navigation is successful.
Supported URL formats:
http(s)://
.mailto:@?subject=
.function openURL(url: string): Promise<void>;
The URL to open.
import wixNavigateMobile from "wix-navigate-mobile";
/* Sample url value: 'https://wa.me/15551234567?text=I%27m%20interested%20in%20your%20car%20for%20sale'*/
wixNavigateMobile
.openURL(url)
.then(() => {
console.log("URL opened successfully!");
return;
})
.catch((error) => {
console.error(error);
// Handle the error
});
/* Promise resolves to void */
This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.