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

边栏推荐
- Queue queue
- Tutorial (5.0) 08 Fortinet security architecture integration and fortixdr * fortiedr * Fortinet network security expert NSE 5
- JS singleton mode
- MYSQL数据高级
- Indexeddb local storage, homepage optimization
- 引擎国产化适配&重构笔记
- Mise en œuvre du rendu de liste et du rendu conditionnel pour l'apprentissage des applets Wechat.
- 线程的六种状态
- Cookie encryption 4 RPC method determines cookie encryption
- 简单的价格表样式代码
猜你喜欢

Juul, the American e-cigarette giant, suffered a disaster, and all products were forced off the shelves

微信小程序學習之 實現列錶渲染和條件渲染.

Groovy obtains Jenkins credentials through withcredentials

Machine learning perceptron and k-nearest neighbor

Producer / consumer model

上升的气泡canvas破碎动画js特效

Indexeddb local storage, homepage optimization

SQL Sever关于like操作符(包括字段数据自动填充空格问题)

415 binary tree (144. preorder traversal of binary tree, 145. postorder traversal of binary tree, 94. inorder traversal of binary tree)

numpy.linspace()
随机推荐
uniapp 开发微信公众号,下拉框默认选中列表第一个
Leetcode-498: diagonal traversal
Programming questions (continuously updated)
416-二叉树(前中后序遍历—迭代法)
2022-06-23: given a nonnegative array, select any number to make the maximum cumulative sum a multiple of 7, and return the maximum cumulative sum. N is larger, to the 5th power of 10. From meituan. 3
413-二叉树基础
Three ways to use applicationcontextinitializer
2022-06-23:给定一个非负数组,任意选择数字,使累加和最大且为7的倍数,返回最大累加和。 n比较大,10的5次方。 来自美团。3.26笔试。
SSM整合
Indexeddb local storage, homepage optimization
Cicflowmeter source code analysis and modification to meet requirements
SQL Sever关于like操作符(包括字段数据自动填充空格问题)
正规方程、、、
利用pandas读取SQL Sever数据表
leetCode-面试题 01.05: 一次编辑
uniapp实现禁止video拖拽快进
Regular matching mailbox
Leetcode - 498: traversée diagonale
Mise en œuvre du rendu de liste et du rendu conditionnel pour l'apprentissage des applets Wechat.
美国电子烟巨头 Juul 遭遇灭顶之灾,所有产品强制下架