Secondary sharing is quite important for H5 pages. After all, QQ still uses the built-in sharing function after it is sent out on WeChat. Different from the PC side, the PC directly copies the address. I was making invitations two days ago, and I encountered a lot of mistakes. Personal development and corporate development are still different. Various issues and other issues should be mentioned in the postscript of an invitation. Let's get down to business.
WeChat secondary sharingWeChat’s documentation is quite good. If you read the whole article, you can basically avoid a lot of pitfalls (remember that WeChat documents are accustomed to writing some pitfalls at the end instead of putting them together)
First, let’s talk about how to do secondary sharing on WeChat. Document address, by introducing the official API. The document is well written, just pass it into shareInfo
directly.
<script src=//res.wx.qq.com/open/js/jweixin-1.2.0.js></script>wx.config({ debug: false, // Turn on debug mode, all APIs called The return value will be alerted on the client side. If you want to view the incoming parameters, you can open it on the PC side. The parameter information will be printed through the log. It will only be printed on the PC side. appId: sign.appid, // Required, the unique identification of the official account timestamp: sign.timestamp, // Required, the timestamp of the generated signature nonceStr: sign.nonceStr, // Required, the random string of the generated signature signature: sign.signature, // Required , signature, see Appendix 1 jsApiList: [ 'onMenuShareTimeline', 'onMenuShareAppMessage', 'onMenuShareQQ', 'onMenuShareWeibo', 'onMenuShareQZone' ] // Required, the list of JS interfaces that need to be used, see Appendix 2 for the list of all JS interfaces}); wx.ready(function() { wx.showOptionMenu(); wx.onMenuShareAppMessage(shareInfo); //Get Share to friends button click status and custom sharing content interface (to be abandoned) wx.onMenuShareTimeline(shareInfo); //Get the click status of the share to Moments button and the custom sharing content interface (soon to be abandoned) wx.onMenuShareQQ(shareInfo); //Get the click status of the share to QQ button and the custom sharing content interface wx.onMenuShareWeibo(shareInfo); / /Get share to Tencent Weibo button click status and custom share content interface wx.onMenuShareQZone(shareInfo); //Get the share to QQ space button click status and custom sharing content interface});Are there any pitfalls in secondary sharing on WeChat?
well? I wrote it correctly, why doesn't it work? There is no requirement written down in the document?
First check the WeChat public platform - development - interface permissions and find that those who do not have permissions are prompted that they have not been obtained, and then go for WeChat authentication. My sharing interface prompts that I have obtained it. What was said above? WeChat's documentation can be viewed later, and there are generally instructions. This is the sentence below, then the problem arises, personal account cannot be authenticated.
Sharing is not possible on iOS and Android (please confirm that the official account has been authenticated. Only certified official accounts have the permission to share related interfaces. If it is indeed authenticated, check whether the listening interface is triggered in the wx.ready callback function)
Sorting out errors about api being unable to adjust
invalid url domain
, my problem is that the js secure domain name is not fixedinvalid url signature
, my problem is that jsapi_ticket
is not updatedThere are documents circulating on the Internet, some API, I tried it, but it doesn't work. Enter through the address, and the final maintenance is for 15 years or something.
How to set up secondary sharingMeta tags are the most scientific.
<meta itemprop=name content=title/><meta itemprop=image content=subtitle/><meta name=description itemprop=description content=share image/>
Is there anything we should pay attention to?
This meta tag cannot be added later, it must be there when entering the page, which means that you can only use the background template. Otherwise, some lower versions Android
cannot get the summary (yes, some mobile phones can get it dynamically), and iOS
does not support it.
In fact, technical articles are time-sensitive.
This article was written on July 30, 2018
Test time July 30, 2018
The above is the entire content of this article. I hope it will be helpful to everyone’s study. I also hope everyone will support VeVb Wulin Network.