Web SDK API

Last updated:2024-04-24
Expand all
Web SDK API
  • new JMLink(config)

  • Interface description: Used to bind background configuration jump application parameters

  • Parameter description: config For initialization parameters, the configuration can pass an array.

  • Call example:

new JMLink({ jmlink: "短链", button: document.querySelector('a#btnOpenApp'), autoLaunchApp: false, downloadWhenUniversalLinkFailed: true, inapp: false, params: {}, appId: "wx4a7ebfe48b832929", timestamp: 1713773225, nonceStr: "Wm3WZYTPz0wzccnt", signature: "ad9ee4f6c1824d8393693127e62677e3fe5c51b8", });
          new JMLink({
 jmlink: "短链",
 button: document.querySelector('a#btnOpenApp'),
 autoLaunchApp: false,
 downloadWhenUniversalLinkFailed: true,
 inapp: false,
 params: {},
 appId: "wx4a7ebfe48b832929",
 timestamp: 1713773225,
 nonceStr: "Wm3WZYTPz0wzccnt",
 signature: "ad9ee4f6c1824d8393693127e62677e3fe5c51b8",
 });

        
This code block is shown in the floating window

Initialization parameters config illustrate

config.jmlink(required)

  • type:String
  • Description: Assigned by the background, short chain address. Short link format:https://xxxxx.jmlk.co/AAaH

config.button(required)

  • type:HTMLAnchorElement (i.e. a tag) or HTMLAnchorElement[] (array of a tags)
  • Description: Open APP The a tag is generally used CSS Define the appearance of the a label so that it looks like a button;
  • Notice:config.button is a required parameter and can only be the a tag, not the button、input or other HTML element, otherwise JMlink Unable to initialize successfully. Why button Is it a necessary parameter? Because many browsers prohibit direct opening through JS APP, the application must be opened manually by the user.

config.autoLaunchApp

  • type:Boolean,default false
  • Description: This option is configured as true when a user opens your integrated jmlink When the page is opened, it supports automatic opening APP in browsers and devices, will automatically invoke APP; But unfortunately some browsers automatically invoke it through JS due to limitations APP, even if this option is set to true The application cannot be opened automatically. In this case, the user needs to manually click the config.button Only the specified link can be opened APP;
  • NOTE: Configure astruewhen not installedAPPIn case, some browsers automatically openAPPThis will cause a system pop-up box to prompt "This URL is invalid"

config.downloadWhenUniversalLinkFailed

  • type:Boolean,default true
  • Description: Used in Universal Link When opening fails, jump directly to the download page

config.inapp

  • type:Boolean,default false
  • Description: When your HTML The page is embedded in APP in Webview time, because APP called in Webv View The functions are different from those of regular browsers, jmlink dependent on Universal Link exist Webview There will be flaws in it, but jmlink It is also impossible to accurately detect whether the currently opened environment is Web iew still APP, so if in APP in Web View use JMLink time, in order to ensure jmlink can be in iOS 9.0 in the above system APP It can also correctly recall the specified APP interface, please set this option to true, set to true hour, jmlink Will be used first Custom URI Scheme to invoke the specified page.

config.params

  • type:Object
  • Description: Pass to APP parameter (recommended), users can use this parameter to pass some parameters from the H5 page to APP used within. These parameters are notJMLinkbackground jmLink Placeholder for parameters set in the service configuration.

config.plhparams

  • type:Object
  • Description: Pass to APP ofplaceholderparameters, these parameters must be the same as yourJMLinkbackground jmlink The parameter placeholder set in the service configuration, otherwise it will be filtered; if APP is installed, then when the app is invoked it opens from APP of URI Scheme or Universal Link You can get the parameters in. If it is the first installation, these parameters can be obtained throughJMLink SDK of API Retrieved from our servers; About SDK How to achieve jmlink Please refer to the correspondingandroid/iOS SDK document
  • Example:
    1. in the background mLink Filled in the service configuration URI Scheme: myapp://path/acticle?articleId=:id
  • 2.config.plhparams:{id: '123456' }
    1. final URI Scheme: myapp://path/acticle?articleId=123456
tips 1. 参数键值对 key - value 中,建议 key 的参数避免有重复的情况,如果 plhparams 和 params 中有相同的key,则以params 中的 key - value 值为准。 2. 参数键值对尽量保持简单化。 避免在参数中直接使用url。
          tips
1. 参数键值对 key - value 中,建议 key 的参数避免有重复的情况,如果 plhparams 和 params 中有相同的key,则以params 中的 key - value 值为准。
2. 参数键值对尽量保持简单化。 避免在参数中直接使用url。 

        
This code block is shown in the floating window

config.invtparams

  • type:Object
  • Description: Invitation parameter, use this parameter to track the source. The currently supported parameters are as follows (parameters other than the following are invalid) u_id: Source user ID
  • Example:invtparams: {u_id: "uid-123456"}

config.universal

  • type:String
  • Description: User-defineduniversal link
  • Notice:
  1. support in judgmentuniversalandinappNot fortrueIn this case, this configuration has the highest priority
  2. urlTry not to repeat the following parameters with other parameters.
  3. This link pull and restore contains other parameters of its type, while other types of pull and restore do not contain parameters on this configuration.
  4. User is doinguniversal linkIn case, not installedappIt will jump to the configured domain name. This means that users need to handle downloading and judgment logic by themselves
  5. This feature is only available for integrationJS-SDK, using short links directly does not include this function
  6. Make sure you have configureduniversal linkconfigure, haveuniversal linkbasic knowledge

config.appId

  • type:String
  • Description: WeChat service account AppID
  • Instructions: Please use WeChatOfficial Account"Settings and Development" of the backend-"Official AccountDevelopment Information"-"Developer ID(AppID)". Please checkAdvanced-Enable WeChat Open Tags

config.timestamp

config.nonceStr

config.signature

Was this document helpful?

Copyright 2011-2026, jiguang.cn, All Rights Reserved. 粤ICP备12056275号-13 Shenzhen Hexun Huagu Information Technology Co., Ltd.

Open in Docs Center