tencent cloud

All product documents
Tencent Cloud Super App as a Service
Navigation
Last updated: 2025-02-25 14:19:31
Navigation
Last updated: 2025-02-25 14:19:31

exitMiniProgram

This API is called using wx.exitMiniProgram(Object object).
Note:
This API is supported in mini programs but not in mini games.
Feature description:Exits the current mini program. This API can only be successfully called as a result of a user tap action.
Parameter and description:Object object.
Property
Type
Default value
‍Required
Description
success
function
-
False
Callback function for successful API calls.
fail
function
-
False
Callback function for failed API calls.
complete
function
-
False
Callback function executed after API call ends (regardless of success or failure).

navigateToMiniProgram

This API is called using wx.navigateToMiniProgram(Object object).
Note:
This API is supported in mini programs but not in mini games.
Feature description:Opens another mini program.
Parameter and description:Object object.
Property
Type
Default value
‍Required
Description
appId
string
-
True
The appId of the mini program to open.
path
string
-
False
The page path to open. If empty, the home page is opened. The string after the ? in the path will become a query, and the query data can be obtained in the mini program’s callback functions App.onLaunch, App.onShow and Page.onLoad, or in wx.getLaunchOptionsSync.
extraData
object
-
False
Data to pass to the target mini program. It can be obtained in App.onLaunch and App.onShow .
envVersion
string
release
False
The version of the mini program to open. This parameter is valid only when the current mini program is in development version or Preview. If the current mini program is the released version, the mini program that is opened must be the released version. Valid values:
develop: The development version
trial: The Preview
release: The released version
success
function
-
False
Callback function for successful API calls.
fail
function
-
False
Callback function for failed API calls.
complete
function
-
False
Callback function executed after API call ends (regardless of success or failure).

Usage restrictions

User trigger required

If the user does not tap anywhere on the mini program page, the developer will not be able to call this API to automatically navigate to another mini program.

User confirmation required

Before navigating to another mini program, a pop-up window will appear asking for user confirmation, and the navigation will proceed after the user confirms that. If the user tapsCancel, it will trigger a callback with fail cancel.

Each mini program can jump to no more than 10 other mini programs

When submitting a new version of mini program code, developers must include a list of up to 10 target mini programs in the code configuration if using the navigation feature. Otherwise, the code will not be approved. The list can be updated with each new version but cannot be dynamically modified. For more information about the configuring method, see Global Configuration. The appId must be in the configuration list, otherwise the fail callback will be triggered with fail appId "${appId}" is not in navigateToMiniProgramAppIdList.
Example:
wx.navigateToMiniProgram({
appId: '',
path: 'page/index/index?id=123',
extraData: {
foo: 'bar'
},
envVersion: 'develop',
success(res) {
// Navigation to mini program successful
}
})

navigateBackMiniProgram

This API is called using wx.navigateBackMiniProgram(Object object).
Note:
This API is supported in mini programs but not in mini games.
Feature description:Returns to the previous mini program. This API can be called successfully only when the current mini program is opened by another mini program.
Parameter and description:Object object.
Property
Type
Default value
‍Required
Description
extraData
Object
{}
False
Data to return to the previous mini program. The previous mini program can access this data in App.onShow.
success
function
-
False
Callback function for successful API calls.
fail
function
-
False
Callback function for failed API calls.
complete
function
-
False
Callback function executed after API call ends (regardless of success or failure).
Example:
wx.navigateBackMiniProgram({
extraData: {
foo: 'bar'
},
success(res) {
// Returned to previous mini program successfully
}
})


Was this page helpful?
You can also Contact Sales or Submit a Ticket for help.
Yes
No

Feedback

Contact Us

Contact our sales team or business advisors to help your business.

Technical Support

Open a ticket if you're looking for further assistance. Our Ticket is 7x24 available.

7x24 Phone Support
Hong Kong, China
+852 800 906 020 (Toll Free)
United States
+1 844 606 0804 (Toll Free)
United Kingdom
+44 808 196 4551 (Toll Free)
Canada
+1 888 605 7930 (Toll Free)
Australia
+61 1300 986 386 (Toll Free)
EdgeOne hotline
+852 300 80699
More local hotlines coming soon