tencent cloud

Tencent Cloud Super App as a Service

Navigation

PDF
Focus Mode
Font Size
Last updated: 2026-04-16 19:57:27

exitMiniProgram

This API is called using wx.exitMiniProgram(Object object).
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).
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
urlContent
string
-
False
The URL content of the mini program to open. Accepts links such as scan results from wx.scanCode. When both appId and urlContent are provided, appId takes priority.
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 taps Cancel, 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',
urlContent: '',
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
}
})



Help and Support

Was this page helpful?

Help us improve! Rate your documentation experience in 5 mins.

Feedback