In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
What is Wechat js? in response to this question, this article introduces in detail the corresponding analysis and answers, hoping to help more partners who want to solve this problem to find a more simple and feasible way.
Wechat JS-SDK is a web development kit based on Wechat provided by Wechat public platform for web developers.
By using Wechat JS-SDK, web developers can take advantage of Wechat's ability to efficiently use mobile systems such as photo, picture selection, voice, location and so on. At the same time, they can directly use Wechat's unique capabilities such as Wechat sharing, scanning, card coupons, and payment to provide Wechat users with a better web experience.
Steps for using JSSDK
Step 1: bind the domain name
Log in to the Wechat public platform and enter the "function Settings" of "official account Settings" to fill in "JS API Security Domain name".
Note: after logging in, you can view the corresponding API permissions in the developer Center.
Step 2: introduce the JS file
Introduce the following JS file (https is supported) on the page that needs to call the JS API: http://res.wx.qq.com/open/js/jweixin-1.4.0.js
If you need to further improve the stability of the service, when the above resources are not accessible, you can visit http://res2.wx.qq.com/open/js/jweixin-1.4.0.js (https is supported).
Note: AMD/CMD standard module loading method is supported.
Step 3: verify the configuration by injecting permissions through the config interface
All pages that need to use JS-SDK must first inject configuration information, otherwise they cannot be called (the same url only needs to be called once. The web app of the SPA that changes the url can be called each time the url changes. Currently, the Android Wechat client does not support the new H5 feature of pushState, so using pushState to implement web app pages will cause signature failure, which will be fixed in Android6.2).
Wx.config ({debug: true, / / enables debug mode. The returned values of all api called will be displayed in the alert on the client side. To view the parameters passed, you can open them on the PC side, and the parameter information will be typed out through log and printed only on the PC side. AppId:'', / / required, unique ID of official account timestamp:, / / required, timestamp for generating signature nonceStr:', / / required, random string for generating signature signature:', / / required, signature jsApiList: [] / / required, list of JS interfaces to be used})
Step 4: successfully verify through the ready interface
Wx.ready (function () {/ / config information verification) executes the ready method, and all API calls must be performed after the config API obtains the result. Config is an asynchronous operation on the client side, so if you need to call the relevant API when the page is loaded, you must call the relevant API in the ready function to ensure correct execution. Interfaces that are called only when triggered by the user can be called directly and do not need to be placed in the ready function. });
Step 5: handle failure verification through error interface
Wx.error (function (res) {/ / config information verification fails) executes the error function. If the verification fails due to the expiration of the signature, the specific error information can be viewed in the debug mode of config or in the returned res parameter. For SPA, you can update the signature here. }), so much for the answer to the question about what Wechat js is. I hope the above content can be of some help to you. If you still have a lot of doubts to be solved, you can follow the industry information channel for more related knowledge.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.