Introduction

Important:

  • This API is only relevant for custom widgets in Branded Apps.
  • Custom widgets are not yet available to all users.
  • This API is in Developer Preview and is subject to change.

The Wix Navigate Mobile API contains functionality for navigating through your mobile app.

To use the Wix Navigate Mobile API, import wixNavigateMobile from wix-navigate-mobile module:

Copy
import wixNavigateMobile from "wix-navigate-mobile";

Stack navigation

Mobile apps built on Wix use stack navigation. Stack navigation means that screens are arranged in a stack, so each new screen is placed on top of the previous screen, much like a stack of cards. App users can navigate back to the previous screen by pressing the back button or by calling closeScreen(). You can think of this action as removing the top screen from the stack.

Did this help?

closeScreen( )


Closes the current screen.

developer preview tag

closeScreen() returns a promise that resolves when the screen closes.

Method Declaration
Copy
function closeScreen(ClosedScreenData: ClosedScreenData): Promise<void>;
Method Parameters
ClosedScreenDataClosedScreenDataRequired

Data to send to the screen beneath this one in the stack. Learn more about stack navigation.

Close a screen
JavaScript
import wixNavigateMobile from "wix-navigate-mobile"; screenData = { data: "This is my screen data.", }; wixNavigateMobile.closeScreen(screenData).then(() => { console.log("Screen closed."); });
Did this help?

getScreenContext( )


Get's the screen's data.

developer preview tag

getScreenContext() returns the screen's data. This includes any data context passed into the screen on which the widget is placed, such as data defined when the screen is opened using toScreen().

Method Declaration
Copy
function getScreenContext(): Promise<ScreenContext>;
Request
This method does not take any parameters
Returns
Return Type:Promise<ScreenContext>
Get a screen's data
JavaScript
import wixNavigateMobile from "wix-navigate-mobile"; wixNavigateMobile .getScreenContext() .then((result) => { console.log("Screen data from feedback screen:", result.data); }) .catch((error) => { console.error(error); });
Did this help?

openURL( )


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

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)://.
  • A URI such as a phone number, geographic coordinates, social media link, or email. For example, mailto:@?subject=.
Method Declaration
Copy
function openURL(url: string): Promise<void>;
Method Parameters
urlstringRequired

The URL to open.

Open a URL in the device's browser
JavaScript
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 */
Did this help?