zoukankan      html  css  js  c++  java
  • 微信的分享功能(针对web手机站页面进行的分享功能)

    欢迎增加php架构师之旅 群:410028331(招纳贤人-大师中)方便技术的交流



    大家注意:本博客是2014年时调用微信分享功能。如今微信分享已经不适用了,下面为个人笔记

    把这段js粘贴进,设置能够分享的页面。当微信打开,就可以微信进行分享各个圈


    $(function(){

        var lujing=$("#logimg").attr("src");  //分享中带有的图片
        var url=window.location.href;         //分享页的地址
        var title=document.title;             //分享内容的标题
        weixin("http://m.e-iot.com/images/bg.jpg",url,title);
     });


                 function weixin(a,b,c){ 
    document.addEventListener('WeixinJSBridgeReady', function onBridgeReady() {


    window.shareData = {
    "imgUrl": a,
    "timeLineLink": b,
    "sendFriendLink": b,
    "weiboLink": b,
    "tTitle": c,
    "tContent": "8+1互助平台---营销型站点互助分享会",
    "fTitle": c,
    "fContent": "8+1互助平台---营销型站点互助分享会",
    "wContent": "8+1互助平台---营销型站点互助分享会"
    };


    // 发送给好友
    WeixinJSBridge.on('menu:share:appmessage', function (argv) {
    WeixinJSBridge.invoke('sendAppMessage', {
    "img_url": window.shareData.imgUrl,
    "img_width": "640",
    "img_height": "640",
    "link": window.shareData.sendFriendLink,
    "desc": window.shareData.fContent,
    "title": window.shareData.fTitle
    }, function (res) {
    _report('send_msg', '111111');
    })
    });


    // 分享到朋友圈
    WeixinJSBridge.on('menu:share:timeline', function (argv) {
    WeixinJSBridge.invoke('shareTimeline', {
    "img_url": window.shareData.imgUrl,
    "img_width": "640",
    "img_height": "640",
    "link": window.shareData.timeLineLink,
    "desc": window.shareData.tContent,
    "title": window.shareData.tTitle
    }, function (res) {
    _report('timeline', res.err_msg);
    });
    });


    // 分享到微博
    WeixinJSBridge.on('menu:share:weibo', function (argv) {
    WeixinJSBridge.invoke('shareWeibo', {
    "content": window.shareData.wContent,
    "url": window.shareData.weiboLink
    }, function (res) {
    _report('weibo', res.err_msg);
    });
    });
    }, false)
                      }
  • 相关阅读:
    asp.net 汉字转拼音类
    NET分页实现及代码
    Web.config配置文件详解(新手必看) (转载)
    偶开通博客啦
    转帖不会乱码的,powershell网络蜘蛛
    ConvertFrom-String 命令研究
    powershell玩转xml之20问
    powershell 判断操作系统版本 命令
    powershell加win的dns服务器,解决网站负载均衡问题
    PowerShell并发控制-命令行参数之四问
  • 原文地址:https://www.cnblogs.com/wzzkaifa/p/7126308.html
Copyright © 2011-2022 走看看