JS SDK DOCUMENT
Back

From WeChat Official Account Admin Platform
Jump to: navigation, search

Contents

Overview

WeChat JS-SDK (JavaScript SDK) is a WeChat-based web page development toolkit provided by the WeChat Official Account Admin Platform for web developers.

Through the WeChat JS-SDK, web developers can easily use native mobile features including taking photos, selecting images, recording voice and location from within WeChat. Developers may also provide WeChat users with a better web-based user experience by directly tapping into WeChat-specific features such as sharing, QR code scanning, coupons and payments.

This document describes how to use the WeChat JS-SDK and contains relevant precautions for web developers.

Steps for Using the JS-SDK

Step 1: Binding Official Account to Domains

Log in to the WeChat Official Account Admin Platform, and choose "Account Info > Functions" to fill in "JS API Security Domain Name".

Note: Developers can view the corresponding API rights in "Developer Center" after logging in.

Step 2: Import the JS Library File

Import the following JS library file in the page where the JS API is to be called (https supported): http://res.wx.qq.com/open/js/jweixin-1.0.0.js.

Note: AMD/CMD standard module loading methods are supported for loading the module.

Step 3: Inject Correct Authentication Configuration via the config API

All pages requiring the JS-SDK must be injected with configuration information otherwise they cannot be called. A web page with a static URL only needs inject the configuration information once. However, a single page application (SPA) that dynamically changes it’s URL must inject updated configuration information each time the URL changes. At the current time, HTML5 pushState is not supported when injecting configuration information in the WeChat Android client. This issue will be corrected in Android version 6.2.

wx.config({
    debug: true, // Enables debugging mode. Return values of all APIs called will be shown on the client. To view the sent parameters, open the log view of developer tools on a computer browser. The parameter information can only be printed when viewed from a computer.
    appId: '', // Required, unique identifier of the official account
    timestamp: '', // Required, timestamp for the generated signature
    nonceStr: '', // Required, random string for the generated signature
    signature: '', // Required, signature. See Appendix 1.
    jsApiList: [] // Required, list of JS APIs to be used. See Appendix 2 for the list of all JS APIs
 });

Step 4: Process the Successful Verification via the ready API

wx.ready(function(){
    // The callback function of ready API will be executed after a successful config authentication, and each API calling must be done after the config API obtains a result. As config is an asynchronous operation, all relevant API calling must be put in the callback function if it needs to be called while the page loads. A user-initiated API call can be called directly without needing to be put in the callback function.

});

Step 5: Process the Failed Verification via the error API

wx.error(function(res){

    // The callback function of error API will be executed if config authentication fails. If authentication failure is due to an expired signature, the detailed error information can be viewed by enabling the debugging mode within config API, or via the returned res parameter. The signature can be updated here for the SPA.

});

Calling an API

All APIs are called through the wx object (or jWeixin object). Parameters are placed in a variable of an JSON object type. In addition to parameters specific to each API type, there are also the following general parameters for all APIs:

  1. success: indicates the callback function executed when the API call is successful
  2. fail: indicates the callback function executed when the API call fails
  3. complete: indicates the callback function executed when the API call has completed, no matter whether it succeeds or fails
  4. cancel: indicates the callback function executed when a user clicks the cancel menu item, available for a those APIs having a user cancel menu item
  5. trigger: indicates the callback function when menu items are clicked, supporting only relevant APIs in menu items

Caution:Do not use asynchronous AJAX to update the sharing content in trigger callback function as sharing is a synchronous operation in the WeChat client and the response from the AJAX request in the current moment will not be returned.

All of the above functions are called with parameters placed in the object. In addition to data returned by specific to each API, there is a general parameter errMsg for all APIs. Its value has the following format:

  1. Successful call: "xxx:ok", with xxx indicating the called API name
  2. User cancelled: "xxx:cancel", with xxx indicating the called API name
  3. Failed call: Contains specific error information

Basic API

API for Determining Whether the Current Client Version Supports the Provided JS

wx.checkJsApi({
    jsApiList: ['chooseImage'] // List of JS APIs to be checked. See Appendix 2 for the list of all JS APIs.
    success: function(res) {
        // Returned as key-value pairs, true for available API and false for unavailable API
        // Example: {"checkResult":{"chooseImage":true},"errMsg":"checkJsApi:ok"}
    });

Note: The checkJsApi is a reserved API newly introduced in WeChat client V6.0.2. The initial release of the developer APIs don’t need to be checked via the checkJsApi API.

Sharing API

Please note that violations including offering rewards to users for sharing content are prohibited. If any such violations are found, official account API access may be permanently revoked.

API for Obtaining Share Status for "Share on Moments" and Customizing Sharing Contents

wx.onMenuShareTimeline({
    title: '', // Sharing title
    link: '', // Sharing link
    imgUrl: '', // Sharing image URL
    success: function () { 
        // Callback function executed after a user confirms sharing
    },
    cancel: function () { 
        // Callback function executed after a user cancels sharing
    }
});

API for Obtaining Send Status for "Send to Chat" and Customizing Sharing Contents

wx.onMenuShareAppMessage({
    title: '', // Sharing title
    desc: '', // Sharing description
    link: '', // Sharing link
    imgUrl: '', // Sharing image URL
    type: '', // Sharing type, such as “music”, “video “ or “link”. It is “link” by default.
    dataUrl: '', // The data URL should be provided for items of type “music” or “video”. It is null by default.
    success: function () { 
        // Callback function executed after a user confirms sharing
    },
    cancel: function () { 
        // Callback function executed after a user cancels sharing
    }
});

Image API

API for Taking Photos or Choosing Images from the Mobile Phone Album

wx.chooseImage({
    success: function (res) {
        var localIds = res.localIds; // Local ID list of selected images. localIds can be used as the src attribute of the img tag to display images.
    }
});

API for Previewing Images

wx.previewImage({
    current: '', // URL of the current image
    urls: [] // URL list of the images to be previewed
});

API for Uploading Images

wx.uploadImage({
    localId: '', // Local ID of the image to be uploaded, obtained from the chooseImage API
    isShowProgressTips: 1, // 1 by default, which shows the progress tips
    success: function (res) {
        var serverId = res.serverId; // Server ID offor the uploaded returned image
    }
});

Note: The uploaded images will expire after 3 three days. Developers can download images to their own servers via the WeChat multimedia API. The serverId obtained here is media_id. Please refer to Transferring Multimedia Files. Calls to the multimedia file download API are currently limited to 10,000 calls per day. To increase the frequency, please write an email titled "Apply for Increase of Multimedia API Calling Limit" to open-weixin@qq.com, briefly describing your project, providing a link to the project, and explaining the projected user quantity and usage quantity.

API for Downloading Images

wx.downloadImage({
    serverId: '', // Server ID of the image to be downloaded, obtained from the uploadImage API
    isShowProgressTips: 1, // 1 by default, which shows the progress tips
    success: function (res) {
        var localId = res.localId; // Local ID where the returnedof the downloaded image is downloaded
    }
});

Audio API

API for Starting Recording

wx.startRecord();

API for Stopping Recording

wx.stopRecord({
    success: function (res) {
        var localId = res.localId;
    }
});

API for Automatically Stopping Recording

wx.onVoiceRecordEnd({
    // The complete callback function will be executed if recording does not stop within 1 minute
    complete: function (res) {
        var localId = res.localId; 
    }
});

API for Playing Voice Recording

wx.playVoice({
    localId: '' // Local ID of the voice recording to be played, obtained from the stopRecord API
});

API for Pausing Voice Recording

wx.pauseVoice({
    localId: '' // Local ID of the voice recording to be paused, obtained from the stopRecord API
});

API for Stopping Voice Recording

wx.stopVoice({
    localId: '' // Local ID of the voice recording to be stopped, obtained from the stopRecord API
});

API for Finishing Playing Voice Recording

wx.onVoicePlayEnd({
    success: function (res) {
        var localId = res.localId; // Local ID of the returned voice recording to be played
    }
});

API for Uploading Voice Recording

wx.uploadVoice({
    localId: '', // Local ID of the voice recording to be uploaded, obtained from the stopRecord API
    isShowProgressTips: 1, // 1 by default, which shows the progress tips
        success: function (res) {
        var serverId = res.serverId; // Server ID of the returned uploaded voice recording
    }
});

Note: Uploaded voice recording will expire after 3three days. Developers can download voices to their own servers via the WeChat multimedia API. The serverId obtained here is media_id. Please refer to Transferring Multimedia Files. Calls to the multimedia file download API are currently limited to 10,000 calls per day. To increase the frequency, please write an email titled "Apply for Increase of Multimedia API Calling Limit" to open-weixin@qq.com, briefly describing your project, providing a link to the project, and explaining the projected user quantity and usage quantity.

API for Downloading Voice Recording

wx.downloadVoice({
    serverId: '', // Server ID of the voice recording to be downloaded, obtained from the uploadVoice API
    isShowProgressTips: 1, // 1 by default, which shows the progress tips
    success: function (res) {
        var localId = res.localId; // Local ID of the downloaded voice
    }
});

Intelligent API

API for Voice Dictation and Returning Dictation Results

wx.translateVoice({
  localId: "", //Local ID of the voice recording to be recognized, obtained from the related recording API. Currently, only supports recognition of Mandarin Chinese
   isShowProgressTips: 1, // 1 by default, which shows the progress tips
   success: function (res) {
       alert(res.translateResult); // Voice dictation result
   }
});

Equipment Information

API for Obtaining Network Status

wx.getNetworkType({
    success: function (res) {
        var networkType = res.networkType; // Returns network type, including 2g, 3g, 4g and wifi
    }
});

Geographic Location

API for Viewing Location by Using the Built-in Map within WeChat

wx.openLocation({
    latitude: 0, // Latitude, floating number, between 90 and -90
    longitude: 0, // Longitude, floating number, between 180 and -180
    name: '', // Location name
    address: '', // Detailed description of address
    scale: 1, // Map scale level, integer value, between 1 and 28. It is the maximum value by default.
    infoUrl: '' // Hyperlink displayed at the bottom of the location viewing interface, which can be clicked to view the URL
});

API for Obtaining Geographic Location

wx.getLocation({
    success: function (res) {
        var latitude = res.latitude; // Latitude, floating number, between 90 and -90
        var longitude = res.longitude; // Longitude, floating number, between 180 and -180
        var speed = res.speed; // Speed, Unit: m/s
        var accuracy = res.accuracy; // Location accuracy
    }
});

Interface Controls

API for Hiding the Top Right Menu

wx.hideOptionMenu();

API for Displaying the Top Right Menu

wx.showOptionMenu();

API for Closing the Current Window

wx.closeWindow();

API for Hiding Menu Items in Batches

wx.hideMenuItems({
    menuList: [] // Menu items to be hidden. See Appendix 3 for a list of all menu items.
});

API for Displaying Menu Items within Sub-Menus

wx.showMenuItems({
    menuList: [] // Menu items to be displayed. See Appendix 3 for a list of all menu items.
});

API for Hiding All Non-basic Menu Items

wx.hideAllNonBaseMenuItem();

API for Displaying All Non-basic Menu Items

wx.showAllNonBaseMenuItem();

Scanning a QR Code

API for Scanning a QR Code

wx.scanQRCode({
    desc: 'scanQRCode desc',
    needResult: 0, // 0 by default, with the scanning result processed by WeChat. The scanning result is directly returned if it is 1.
    scanType: ["qrCode","barCode"], // Scanning type, including QR code or bar code. Both by default.
    success: function (res) {
        var result = res.resultStr; // Scanning result when needResult is 1
    }
});

WeChat Coupons

Display a List of Store-Suitable Coupons and Obtaining the User’s Selection

wx.chooseCard({
    shopId: '', // Store ID
    cardType: '', // Coupon type
    cardId: '', // Coupon ID
    timestamp: 0, // Signature’s timestamp
    nonceStr: '', // Signature’s random string 
    signType: '', // Signature type, SHA1 by default
    cardSign: '', // Coupon signature. See Appendix 4 for details.
    success: function (res) {
        var cardList= res.cardList; // List of coupons selected by the user
    }
});

API for Adding Multiple Coupons

wx.addCard({
    cardList: [{
        cardId: '',
        cardExt: ''
    }], // List of coupons to be added
    success: function (res) {
        var cardList = res.cardList; // List of added coupons
    }
});

API for Viewing Coupons in WeChat Card Pack

wx.openCard({
    cardList: [{
        cardId: '',
        code: ''
    }]// List of coupons to be opened
});

Appendix 1: Signature Algorithm for the JS-SDK Using Rights

jsapi_ticket

Developers must retrieve a jsapi_ticket, the temporary ticket for the official account to call the WeChat JS APIs, before generating a signature. By default, the jsapi_ticket will be valid for 2 hours (7,200 seconds), and can be obtained via access_token. As there is a cap to the number of API calls made for obtaining a jsapi_ticket, refreshing jsapi_ticket too frequently will result in disabled access and potentially affect your access to the API. Therefore, developers should globally cache jsapi_ticket on their own servers.

  1. Refer to the following document for obtaining access_token (validity period of 7,200 seconds; developers should globally cache access_token on their own servers):Access token.
  2. Obtain jsapi_ticket via HTTP GET method by using the access_token obtained in step 1 (validity period of 7,200 seconds; developers should globally cache jsapi_ticket on their own servers):https://api.wechat.com/cgi-bin/ticket/getticket?access_token=ACCESS_TOKEN&type=jsapi.

The following JSON is an example of a successful reply:

{
    "errcode":0,
    "errmsg":"ok",
    "ticket":"bxLdikRXVbTPdHSM05e5u5sUoXNKd8-41ZO3MhKoyN5OfkWITDGgnr2fwJ0m9E8NYzWKVZvdVtaUgWvsdshFKA",
    "expires_in":7200
}

After jsapi_ticket is obtained, signature for the JS-SDK API calls can be generated.

Signature Algorithm

Signature generating rules are as follows: Fields included in the signature include noncestr (random string), a valid jsapi_ticket and timestamp, and url (URL of the current web page, excluding the URL fragment identifier # and its following parts). After sorting all parameters used for signature in the ordered by each field names’ ASCII code from small to large (lexicographical order), divide string1 into key-value pairs (key1=value1&key2=value2…). Note that all parameter names should be in lowercase. Apply SHA1 encryption on string1, adopting the original values of field name and field value without escaping the URL.

In short, signature=sha1(string1). Example:

  • noncestr=Wm3WZYTPz0wzccnW
  • jsapi_ticket=sM4AOVdWfPE4DxkXGEs8VMCPGGVi4C3VM0P37wVUCFvkVAy_90u5h9nbSlYy3-Sl-HhTdfl2fzFy1AOcHKP7qg
  • timestamp=1414587457
  • url=http://admin.wechat.com

Step 1: After sorting all parameters used for the signature by the ASCII codes of field name from small to large (lexicographical order), divide string1 into key-value pairs (key1=value1&key2=value2…):

jsapi_ticket=sM4AOVdWfPE4DxkXGEs8VMCPGGVi4C3VM0P37wVUCFvkVAy_90u5h9nbSlYy3-Sl-HhTdfl2fzFy1AOcHKP7qg&noncestr=Wm3WZYTPz0wzccnW&timestamp=1414587457&url=http://mp.weixin.qq.com

Step 2: Perform SHA1 encryption on string1 to obtain the signature:

f4d90daf4b3bca3078ab155816175ba34c443a7b

Caution:

  1. The noncestr and timestamp parameters used for signature must be the same as those used in wx.config API.
  2. The url parameter used for signature must be the complete URL of the JS API calling page(excluding the URL fragment identifier # and its following parts).
  3. For security considerations, developers must implement signature logic on their server.

Consult Appendix 5 if an error due to an invalid signature occurs.

Appendix 2: List of All JS APIs

V1.0.0 APIs

  • onMenuShareTimeline
  • onMenuShareAppMessage
  • startRecord
  • stopRecord
  • onVoiceRecordEnd
  • playVoice
  • pauseVoice
  • stopVoice
  • onVoicePlayEnd
  • uploadVoice
  • downloadVoice
  • chooseImage
  • previewImage
  • uploadImage
  • downloadImage
  • translateVoice
  • getNetworkType
  • openLocation
  • getLocation
  • hideOptionMenu
  • showOptionMenu
  • hideMenuItems
  • showMenuItems
  • hideAllNonBaseMenuItem
  • showAllNonBaseMenuItem
  • closeWindow
  • scanQRCode
  • addCard
  • chooseCard
  • openCard

Appendix 3: List of All Menu Items

Basic Menu

  • Report Abuse: "menuItem:exposeArticle"
  • Text Size: "menuItem:setFont"
  • Day Mode: "menuItem:dayMode"
  • Night Mode: "menuItem:nightMode"
  • Refresh: "menuItem:refresh"
  • View Official Account (Added): "menuItem:profile"
  • View Official Account (Non-added): "menuItem:addContact"

Share Menu

  • Send to Chat: "menuItem:share:appMessage"
  • Share on Moments: "menuItem:share:timeline"
  • Favorite: "menuItem:favorite"
  • Share on Facebook: "menuItem:share:facebook"

Secure Menu

  • Debug: "menuItem:jsDebug"
  • Edit Tag: "menuItem:editTag"
  • Delete: "menuItem:delete"
  • Copy URL: "menuItem:copyUrl"
  • Original Page: "menuItem:originPage"
  • Read Mode: "menuItem:readMode"
  • Open in Safari: "menuItem:openWithSafari"
  • Email: "menuItem:share:email"
  • Some Special Official Accounts: "menuItem:share:brand"

Appendix 4: Coupon Extension Field and Signature Generation Algorithm

Description of Coupon Extension Field “cardExt”

As a JSON string, cardExt a JSON string providing unique information assigned by a merchant for a coupon. It includes the following fields:

Parameter Required Description
code No A code specific to the instance of the coupon, which can be received only once. It is required when use_custom_code is set to true, otherwise not required.
openid No OpenID of the specified recipient, which can only be received by that user. It is required for coupons with bind_openid being true, otherwise not required.
timestamp Yes Timestamp, indicating the number of seconds since 00:00:00 of January 1st, 1970 to the current time as generated by the Vendor , and converted to a character string.

It is imported after being generated by the Vendor.

signature Yes Signature, which is generated by the Vendor based on parameters in this table according to the specified SHA1 mode. For the specific signature scheme, see the following description. It is imported after being generated by the Vendor in compliance with specifications.
balance No Lucky Money balance, in the unit of 0.01 yuan.The field is required for lucky money (LUCKY_MONEY) coupon types, otherwise not required.

Signature Description

  1. Sort values of appsecret (unique certificate password of a third-party user), timestamp, card_id, code, openid and balance in lexicographical order.
  2. Join character strings of all parameters in to one string, and then perform SHA1 encryption to obtain the signature.
  3. Timestamp in the signature must be consistent with that in card_ext.
  4. If code=23456, timestamp=141231233, card_id=345667, and appsecret=456789, then signature=sha1(14123123323456345667456789)=4F76593A4245644FAE4E1BC940F6422A0C3EC03E.

Description of Coupon Signature cardSign

  1. Sort values of appsecret, app_id, location_id, times_tamp, nonce_str, card_id and card_type in lexicographical order.
  2. Join character strings of all parameters in to one string, and then perform SHA1 encryption to obtain the cardSign.

Appendix 5: Common Errors and Solutions

Using “debug: true” when calling the config API can enable debugging mode and alert error information on the page. Common errors and solutions are as follows:

  1. Invalid url domain: The domain name of the current page is not bound to the used appid. (One appid can bind to three valid domain names. For details, see 1.1.1.)
  2. Invalid signature: It is recommended to check the following in order:
    1. Check whether the signature algorithm is correct.
    2. Check whether nonceStr and timestamp in the config parameter are consistent with those used in the signature.
    3. Check whether url is the complete URL of the page (with the wrong URL alerted), including query string parameters after '?' and excluding the URL fragment identifier '#' part.
    4. Check whether appid in the config parameter is consistent with that used for obtaining jsapi_titicket.
    5. Make sure that you have cached access_token and jsapi_ticket.
    6. Make sure that the URL used for signature is dynamically generated, in other words, not hardcoded. For generating a dynamic url, refer to the implementation code in PHP in the instance code. If a static html page transfers the URL from the client to the server for signature via AJAX, the client side needs to use JavaScript to obtain the URL of the current page excluding the URL fragment identifier '#' part (code example: location.href.split('#')[0]). Once the page is shared, the WeChat client will add other parameters to the end of the URL, in this case, If the current URL is not dynamically obtained, signature of the shared page will fail.
  3. the permission value is offline verifying. This error is caused because config is not successfully executed, or the called JSAPI is not imported into the jsApiList parameter of config. It is recommended to check in the following order:
    1. Check whether config is correctly executed.
    2. If the APIs are to be called once the page has completely loaded, they must be called in the callback function of wx.ready API.
    3. Check whether the jsApiList parameter of config includes the APIs you have called.
  4. Permission denied:. The official account has no rights to use this API. (Some APIs may only be used only after being given access right.)
  5. The Android user has cancelled sharing on Moments, but a sharing success message is still returned. (The WeChat Team is aware of this problem and will be fixed in Android V6.1.)
  6. Sharing fails on both iOS and Android systems. (Check whether the official account has been verified. Only the verified official accounts have the right to relevant sharing APIs. For verified official accounts, check whether the relevant share-listening APIs are triggered in the callback function of wx.ready API.)
  7. Some Android V6.0.2 clients fail to use the share-listening API. (This problem does not apply to versions earlier than Android V6.0.2 or later than V6.0.2.58. Please download the latest version from weixin.qq.com.)
  8. Developers fail to obtain jsapi_ticket after services go live, but the previous test succeeds. (Developers must cache access_token and jsapi_ticket on their own servers; otherwise, frequency cap will be triggered after services go live. Please be sure to cache the token and ticket to reduce redundant server requests, as this will avert a frequency cap and also speeds up your services. A frequency cap of 10,000 calls is currently provided to facilitate testing, and services will not be available once this limit is reached. Be sure to globally cache access_token and jsapi_ticket before services go live, both of which will be valid for 2 hours (7,200 seconds). Otherwise, services will not be available once the frequency cap is triggered.)
  9. The API for uploading images is occasionally blocked in some Android versions. (This problem exists in Android V6.0.2, and it has been fixed in versions later than V6.0.2.58. Please download the latest version from the official website.)
  10. How do you upload multiple images using uploadImage? (Image can only be uploaded one-at-a-time currently. To upload multiple images, call this API again after uploading the prior image.)
  11. HttpGet in the sample code fails to support https. (This problem has been addressed on January 11, 2015. For the demo downloaded earlier than that day, please download the latest sample code.)
  12. Image compression issue. The upload API in JS-SDK sets no limitation on the size of upload resources. (Compression support has been added to Android V6.0.2, and will be added to iOS V6.1.)
  13. Locally selected images fail to be previewed. (No extra support is required because the chooseImage API supports preview.)
  14. Invalid signature is displayed when jumping from URL a to URL b. (The URL used for generating the signature on the background is the current URL using JS-SDK, that is, URL b. Remember that the URL used for background signature must be the complete URL of the current page using JS-SDK excluding the URL fragment identifier '#' part.)
  15. Are extra steps necessary for compatibility with earlier WeChat versions? (JS-SDK is compatible with earlier versions, without needing the developer to take extra steps. Note that some APIs newly introduced since V6.0.2 can only be called in later versions.)
  16. config:fail. (This error is caused because the imported config parameter is incomplete. Make sure that appId, timestamp, nonceStr, signature, and jsApiList are correctly included.)
  17. How do you download the multimedia resources uploaded to WeChat through the JS API to the developer's server? (Please see the remarks about uploadVoice and uploadImage in this document.)
  18. The serverId that is uploaded through other devices can be successfully downloaded but fails to be played in Android. (This problem has been confirmed by WeChat Team and will be fixed in Android V6.1.)
  19. Is the JS SDK available for subdomains whose parent domain has finished the binding? (Yes, it is fully available for the correct subdomains after their parent domain has finished the binding.)
  20. Web page which is opened via Scanning QR Code in WeChat Android client will be closed after calling the scanQRCode API with scanning result returns directly. (This problem has been confirmed by WeChat Team and will be fixed in Android V6.1.)
  21. External images outside WeChat Admin platform can not be shown in ios V6.1, but those from within WeChat Admin platform or WeChat server do not have this problem. (This problem has been confirmed by WeChat Team and will be fixed in ios V6.2.)
  22. Multimedia resources uploaded from Android to WeChat server through JS -APISDK may have noises on the third-party server after being downloaded. (This problem has been confirmed by WeChat team and will be fixed.)
  23. The JS APIs related to images and voices can only download the resources uploaded through JS API, but cannot download the resources uploaded through the multimedia background API. (This problem has been confirmed by WeChat team and will be fixed.)
  24. Voice recording which is speex-filetype and uploaded via JS API can not be directly played in developer’s page. (This problem has been confirmed by WeChat team and will be fixed. Developers can download the amr-filetype version to their own servers via the WeChat multimedia API.)
  25. Injection will fail if developer use the pushState feature of HTML5 which is not yet supported in WeChat Android client and it will be fixed in Android V6.2.

Appendix 6: Sample Code

Sample Code:

jssdk_sample.zip

Remark: Sample code implemented in PHP and provided for reference to developers. All developers must cache the retrieved access_token and jsapi_ticket to avoid frequency caps.

Developer Guide
Custom-defined Menu
WeChat JS-SDK