当前位置:网站首页>How to customize sharing links in wechat for H5 web pages
How to customize sharing links in wechat for H5 web pages
2022-06-24 10:16:00 【Ma Xiaotiao coding】
1. introduce js file
<script src="http://res.wx.qq.com/open/js/jweixin-1.4.0.js" type="text/javascript"></script>
2. Call the interface to receive the following data :
<!-- Sharing features -->
<script>
$.ajax({
url: "/public/index.php/index/index/jsconfig.html",
dataType: 'JSON',
data: {
url:window.location.href
},
type: 'POST',
success: function(res) {
console.log(' Print res',res)
wx.config({
debug: false, // Turn on debugging mode , Call all api The return value of will be on the client side alert come out , To see the parameters passed in , Can be in pc End open , The parameter information will go through log play , Only in pc Only when the end is printed .
appId: res.msg.appId, // Required , The only sign of official account number
timestamp:res.msg.timestamp, // Required , Generate signature timestamp
nonceStr: res.msg.nonceStr, // Required , Generate a random string of signatures
signature: res.msg.signature,// Required , Signature , See appendix 1
jsApiList: res.msg.jsApiList // Required , Required JS Interface list , all JS See Appendix... For the list of interfaces 2
});
},
error: function(retrunData) {
});
</script>
Project operation :
In a h5 In the developed official account project , When sharing, the first image of the page is displayed by default as the cover image of the sharing link , Can't customize pictures to share with friends , The solution here is :
Add one at the top of each page logo chart , And set the width to 0, Just to keep it from showing . It only works when sharing .
<img src="__IMG__/mylogo.jpg" style="width:0 ;" >

边栏推荐
猜你喜欢
随机推荐
CVPR 2022 Oral | 英伟达提出自适应token的高效视觉Transformer网络A-ViT,不重要的token可以提前停止计算
Record the range of data that MySQL update will lock
How to manage massive network infrastructure?
413-二叉树基础
Phpstrom code formatting settings
numpy.logical_and()
Floating point notation (summarized from cs61c and CMU CSAPP)
414-二叉树的递归遍历
CVPR 2022 oral | NVIDIA proposes an efficient visual transformer network a-vit with adaptive token. The calculation of unimportant tokens can be stopped in advance
100 GIS practical application cases (XIV) -arcgis attribute connection and using Excel
leetCode-1051: 高度检查器
np.float32()
学习整理在php中使用KindEditor富文本编辑器
Engine localization adaptation & Reconstruction notes
Geogebra instance clock
413 binary tree Foundation
Array seamless scrolling demo
Safety and food security for teachers and students of the trapped Yingxi middle school
[input method] so far, there are so many Chinese character input methods!
如何在一个页面上使用多个KindEditor编辑器并将值传递到服务器端









