当前位置:网站首页>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 ;" >

边栏推荐
- Detailed explanation of PHP singleton mode
- 队列Queue
- 一群骷髅在飞canvas动画js特效
- canvas掉落的小球重力js特效动画
- How to manage massive network infrastructure?
- 学习整理在php中使用KindEditor富文本编辑器
- 卷妹带你学jdbc---2天冲刺Day1
- leetCode-1051: 高度检查器
- Network of test and development - Common Service Protocols
- Getting user information for applet learning (getuserprofile and getUserInfo)
猜你喜欢

队列Queue

How does home office manage the data center network infrastructure?

Yolov6: the fast and accurate target detection framework is open source

整理接口性能优化技巧,干掉慢代码

SVG+js拖拽滑块圆形进度条

形状变化loader加载jsjs特效代码

uniapp开发微信小程序,显示地图功能,且点击后打开高德或腾讯地图。

大中型企业如何构建自己的监控体系

415-二叉树(144. 二叉树的前序遍历、145. 二叉树的后序遍历、94. 二叉树的中序遍历)

Cicflowmeter source code analysis and modification to meet requirements
随机推荐
Tutorial (5.0) 08 Fortinet security architecture integration and fortixdr * fortiedr * Fortinet network security expert NSE 5
Leetcode - 498: traversée diagonale
Yolov6: the fast and accurate target detection framework is open source
Recursive traversal of 414 binary tree
Troubleshooting steps for Oracle pool connection request timeout
物联网?快来看 Arduino 上云啦
415 binary tree (144. preorder traversal of binary tree, 145. postorder traversal of binary tree, 94. inorder traversal of binary tree)
El table Click to add row style
dedecms模板文件讲解以及首页标签替换
SVG+js拖拽滑块圆形进度条
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
5.菜品管理业务开发
Canvas draw picture
队列Queue
Producer / consumer model
3.员工的增删改查
uniapp实现禁止video拖拽快进
Using pandas to read SQL server data table
Array seamless scrolling demo
卷妹带你学jdbc---2天冲刺Day1