javascript实现分享,javascript实现微信分享

日期:2019-09-07编辑作者:关于计算机

代码很简单,笔者这里就非常少废话了,直接奉上源码:

javascript落实微信分享,javascript达成分享

代码很简短,作者这里就非常的少废话了,直接奉上源码:

复制代码 代码如下:

<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    <title>喝喝</title>
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="expires" content="0">   
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="This is my page">
    <!--
    <link rel="stylesheet" type="text/css" href="styles.css">
    -->
<script>
var imgUrl = '';
var lineLink = '';
var descContent = "万达狂喜节, 夺宝幸运星大抽取奖品活动开首啦!";
var shareTitle = '万达狂喜节';
var appid = 'wxc9937e3a66af6dc8';
function shareFriend() {
    WeixinJSBridge.invoke('sendAppMessage',{
                            "appid": appid,
                            "img_url": imgUrl,
                            "img_width": "640",
                            "img_height": "640",
                            "link": lineLink,
                            "desc": descContent,
                            "title": shareTitle
                            }, function(res) {
                            _report('send_msg', res.err_msg);
                            })
}
function shareTimeline() {
    WeixinJSBridge.invoke('shareTimeline',{
                            "img_url": imgUrl,
                            "img_width": "640",
                            "img_height": "640",
                            "link": lineLink,
                            "desc": descContent,
                            "title": shareTitle
                            }, function(res) {
                            _report('timeline', res.err_msg);
                            });
}
function shareWeibo() {
    WeixinJSBridge.invoke('shareWeibo',{
                            "content": descContent,
                            "url": lineLink,
                            }, function(res) {
                            _report('weibo', res.err_msg);
                            });
}
// 当微信内置浏览器完结内部开始化后会触发WeixinJSBridgeReady事件。
document.addEventListener('WeixinJSBridgeReady', function onBridgeReady() {
        // 发送给好朋友
        WeixinJSBridge.on('menu:share:appmessage', function(argv){
            shareFriend();
            });
        // 分享到交际圈
        WeixinJSBridge.on('menu:share:timeline', function(argv){
            shareTimeline();
            });
        // 共享到今日头条
        WeixinJSBridge.on('menu:share:weibo', function(argv){
            shareWeibo();
            });
        }, false);
</script>

  </head>
 
  <body>
       <!-- <script>
       var imgUrl = "";
         var lineLink = "";
         var descContent = '测量检验别当真';
         var shareTitle = '分享';
        var appid = 'wx1259b351c201841d';
        function shareFriend() {
            WeixinJSBridge.invoke('sendAppMessage',{
                "appid": appid,
                "img_url": imgUrl,
                "img_width": "200",
                "img_height": "200",
                "link": lineLink,
                "desc": descContent,
                "title": shareTitle
            }, function(res) {
                //_report('send_msg', res.err_msg);
            });
        }
        function shareTimeline() {
            WeixinJSBridge.invoke('shareTimeline',{
                "img_url": imgUrl,
                "img_width": "200",
                "img_height": "200",
                "link": lineLink,
                "desc": descContent,
                "title": shareTitle
            }, function(res) {
                   //_report('timeline', res.err_msg);
            });
        }
        function shareWeibo() {
            WeixinJSBridge.invoke('shareWeibo',{
                "content": descContent,
                "url": lineLink,
            }, function(res) {
                //_report('weibo', res.err_msg);
            });
        }
        // 当微信内置浏览器实现内部早先化后会触发WeixinJSBridgeReady事件。
        document.addEventListener('WeixinJSBridgeReady', function onBridgeReady() {
            // 发送给老铁
            WeixinJSBridge.on('menu:share:appmessage', function(argv){
                shareFriend();
            });
            // 分享到对象圈
            WeixinJSBridge.on('menu:share:timeline', function(argv){
                shareTimeline();
            });
            // 分享到新浪
            WeixinJSBridge.on('menu:share:weibo', function(argv){
                shareWeibo();
            });
        }, false);
        </script> -->
            <h1>呵呵呵呵</h1>          
  </body>
</html>

是或不是很好用呢小同伴们。大家美化下用到和睦的品类中去吧

代码非常粗略,笔者那边就相当的少废话了,直接奉上源码: 复制代码 代码如下: %@ page language="java" impor...

复制代码 代码如下:

<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    <title>喝喝</title>
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="expires" content="0">   
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="This is my page">
    <!--
    <link rel="stylesheet" type="text/css" href="styles.css">
    -->
<script>
var imgUrl = '';
var lineLink = '';
var descContent = "万达狂喜节, 夺宝幸运星大抽取奖品活动始于啦!";
var shareTitle = '万达狂热节';
var appid = 'wxc9937e3a66af6dc8';
function shareFriend() {
    WeixinJSBridge.invoke('sendAppMessage',{
                            "appid": appid,
                            "img_url": imgUrl,
                            "img_width": "640",
                            "img_height": "640",
                            "link": lineLink,
                            "desc": descContent,
                            "title": shareTitle
                            }, function(res) {
                            _report('send_msg', res.err_msg);
                            })
}
function shareTimeline() {
    WeixinJSBridge.invoke('shareTimeline',{
                            "img_url": imgUrl,
                            "img_width": "640",
                            "img_height": "640",
                            "link": lineLink,
                            "desc": descContent,
                            "title": shareTitle
                            }, function(res) {
                            _report('timeline', res.err_msg);
                            });
}
function shareWeibo() {
    WeixinJSBridge.invoke('shareWeibo',{
                            "content": descContent,
                            "url": lineLink,
                            }, function(res) {
                            _report('weibo', res.err_msg);
                            });
}
// 当微信内置浏览器完毕内部开首化后会触发WeixinJSBridgeReady事件。
document.addEventListener('WeixinJSBridgeReady', function onBridgeReady() {
        // 发送给亲密的朋友
        WeixinJSBridge.on('menu:share:appmessage', function(argv){
            shareFriend();
            });
        // 分享到交际圈
        WeixinJSBridge.on('menu:share:timeline', function(argv){
            shareTimeline();
            });
        // 分享到腾讯网
        WeixinJSBridge.on('menu:share:weibo', function(argv){
            shareWeibo();
            });
        }, false);
</script>

  </head>
 
  <body>
       <!-- <script>
       var imgUrl = "";
         var lineLink = "";
         var descContent = '测量检验别当真';
         var shareTitle = '分享';
        var appid = 'wx1259b351c201841d';
        function shareFriend() {
            WeixinJSBridge.invoke('sendAppMessage',{
                "appid": appid,
                "img_url": imgUrl,
                "img_width": "200",
                "img_height": "200",
                "link": lineLink,
                "desc": descContent,
                "title": shareTitle
            }, function(res) {
                //_report('send_msg', res.err_msg);
            });
        }
        function shareTimeline() {
            WeixinJSBridge.invoke('shareTimeline',{
                "img_url": imgUrl,
                "img_width": "200",
                "img_height": "200",
                "link": lineLink,
                "desc": descContent,
                "title": shareTitle
            }, function(res) {
                   //_report('timeline', res.err_msg);
            });
        }
        function shareWeibo() {
            WeixinJSBridge.invoke('shareWeibo',{
                "content": descContent,
                "url": lineLink,
            }, function(res) {
                //_report('weibo', res.err_msg);
            });
        }
        // 当微信内置浏览器完结内部开始化后会触发WeixinJSBridgeReady事件。
        document.addEventListener('WeixinJSBridgeReady', function onBridgeReady() {
            // 发送给亲密的朋友
            WeixinJSBridge.on('menu:share:appmessage', function(argv){
                shareFriend();
            });
            // 分享到生活圈
            WeixinJSBridge.on('menu:share:timeline', function(argv){
                shareTimeline();
            });
            // 分享到今日头条
            WeixinJSBridge.on('menu:share:weibo', function(argv){
                shareWeibo();
            });
        }, false);
        </script> -->
            <h1>呵呵呵呵</h1>          
  </body>
</html>

是还是不是很好用吗小伙伴们。大家美化下用到本人的类别中去吧

你大概感兴趣的篇章:

  • VueJs单页应用完毕微信网页授权及微信分享功效示例
  • 微信分享调用jssdk实例
  • JS中静态页面实现微信共享功效
  • Javascript 完结微信分享(QQ、交际圈、分享给相恋的人)
  • js微信共享API
  • javascript获取wx.config内部字段消除微信分享
  • js达成微信分享代码
  • javascript达成修改微信分享的标题内容等
  • js完结通用的微信分享组件示例
  • js微信分享落成代码

本文由今晚最快开奖现场直播发布于关于计算机,转载请注明出处:javascript实现分享,javascript实现微信分享

关键词:

jQuery中even选用器的定义和用法

本文实例呈报了jQuery中even选择器的概念和用法。共享给我们供我们参谋。具体深入分析如下: jQuery中even选用器的概...

详细>>

js对象聚集,创造js对象和js类的方法汇总

代码很简单,就不多废话了。 创建js对象和js类的方法汇总,js对象汇总 代码很简单,就不多废话了。 复制代码 代码...

详细>>

运用javascript实现Iframe自适应中度

方法一: 那边介绍八个最棒轻巧的办法,不用写什么推断浏览器高度、宽度啥的。 复制代码 代码如下: 上面包车型地...

详细>>

使用javascript获取页面名称

代码很简单,就不多废话了,奉上代码: 复制代码 代码如下: // 取当前页面名称(不带后缀名) function getPageName1() {  ...

详细>>