wx.miniapp.registOpenURL

View Markdown

Last edited on 2026-08-21

iOS >= 1.0.17, Android >= 1.0.8

Listen for events when entering the App and retrieve parameters. Developers can monitor events where users enter the App via Scheme, Universal Link, or the WeChat Open Tag wx-open-launch-app, and retrieve the carried parameters.

Scheme

If developers wish to use Scheme to jump into the App, they need to configure the Scheme name and other settings in project.miniapp.json (Note: The configuration locations differ for Android and iOS. Please refer to the screenshots below).

Please use Developer Tools version 1.06.2307312 or higher

  • iOS: Configure under URL Types in Application Settings (info.plist). For concepts, refer to Apple Documentation
  • Android: Other Settings -> URL Schemes configuration. Fill in the scheme field.

Configuring Multiple Schemes

  • iOS: After switching project.miniapp.json to JSON format, configure additionalCFBundleURLTypes
"CFBundleURLTypes": {
    "CFBundleURLName": "wechat",
    "CFBundleURLSchemes": "wechat",
    "CFBundleTypeRole": "Viewer",
    "additionalCFBundleURLTypes": [
        {
            "CFBundleURLName": "hello",
            "CFBundleURLSchemes": "hello",
            "CFBundleTypeRole": "Viewer"
        }
    ]
},
  • Android: In the scheme field of project.miniapp.json, separate multiple values with commas, such as wechat,qq,miniprogram

Usage Instructions

If the configured scheme is weauth, you can invoke the application directly via the href attribute on an H5 page after the application has been installed.

<a href="weauth://page/a/b?query=test">test:<a><br/>

Note: The standard a tag implementation does not work in the WeChat Browser. You must use WeChat Open Tags for this purpose. For details, refer to wx-open-launch-app.

  • Universal Link is only supported on iOS

  • When building an iOS application, the Universal Link registered on the WeChat Open Platform will be used. Developers need to configure settings such as apple-app-site-association according to Apple's official documentation.

WeChat Open Tag wx-open-launch-app

Internally, the WeChat Open Tag for entering multi-platform applications still relies on the aforementioned mechanism; it simply carries its own data format.

Note: On iOS, because the underlying implementation of WeChat Open Tags is based on Scheme or Universal Link to enter the App, it will first trigger a callback with a different action type, and then trigger one of the opensdkOnRep type. This behavior does not occur on Android.

JSAPI Code Example

wx.miniapp.registOpenURL((param) => {
    console.log('regsitOpenUrl', param)
})

Callback Parameters

Property Type Description
action string Method used to launch the App: 'scheme','webpageURL','opensdkOnRep'
data object Detailed information carried
// If entering via scheme
const param = {
    action: 'scheme',
    data: {
        url: 'xxx',
        host: 'xxx',
        path: 'xxx',
        query: 'xxx'
    }
}
// If entering via Universal Link
const param = {
    action: 'webpageURL',
    data: {
        url: 'xxx',
        host: 'xxx',
        path: 'xxx',
        query: 'xxx'
    }
}
// If entering via WeChat Open Tag
const param = {
    action: 'opensdkOnRep',
    data: 'extraInfo' // string type pass-through
}

Directly Opening an App Page

Starting from iOS >= 1.1.13, when opening an App via Scheme / Universal Link, it supports carrying corresponding parameters to directly open the App page.

Configuration

To use this feature on iOS, developers must enable the switch as shown in the image below in project.miniapp.json.

Example

Scheme

Append the page path directly after the Scheme, as follows:

YOUR_APP_SCHEME://pages/index/index?q=123

The page parameter specifies the page to navigate to. Note that the parameter must be encoded using encodeURIComponent, as follows:

'https://dev.weixin.qq.com/app?page=' + encodeURIComponent('/pages/index/index?q=123')

->

https://dev.weixin.qq.com/app?page=%2Fpages%2Findex%2Findex%3Fq%3D123

SDK does not handle navigation

With the new feature enabled, developers can specify the parameter __donutDontNavigate__=true to prevent the SDK from automatically handling navigation, thereby retaining the ability to manage navigation logic independently. Example:

YOUR_APP_SCHEME://pages/index/index?q=123&__donutDontNavigate__=true

https://dev.weixin.qq.com/app?page=%2Fpages%2Findex%2Findex%3Fq%3D123&__donutDontNavigate__=true

wx.miniapp.unRegistOpenURL

Cancels the listener function registered by wx.miniapp.registOpenURL. The input parameter is the previously registered function.

const openUrlListener = (param) => {
    console.log('regsitOpenUrl', param)
}

wx.miniapp.registOpenURL(openUrlListener)
wx.miniapp.unRegistOpenURL(openUrlListener)