• linkedu视频
  • 平面设计
  • 电脑入门
  • 操作系统
  • 办公应用
  • 电脑硬件
  • 动画设计
  • 3D设计
  • 网页设计
  • CAD设计
  • 影音处理
  • 数据库
  • 程序设计
  • 认证考试
  • 信息管理
  • 信息安全
菜单
linkedu.com专业计算机教程网站
  • 网页制作
  • 数据库
  • 程序设计
  • 操作系统
  • CMS教程
  • 游戏攻略
  • 脚本语言
  • 平面设计
  • 软件教程
  • 网络安全
  • 电脑知识
  • 服务器
  • 视频教程
  • html/xhtml
  • html5
  • CSS
  • XML/XSLT
  • Dreamweaver教程
  • Frontpage教程
  • 心得技巧
  • bootstrap
  • vue
  • AngularJS
  • HBuilder教程
  • css3
  • 浏览器兼容
  • div/css
  • 网页编辑器
  • axure
您的位置:首页 > 网页设计 >html5 > 如何利用HTML5实现分享到微信好友朋友圈QQ好友QQ空间微博二维码的功能

如何利用HTML5实现分享到微信好友朋友圈QQ好友QQ空间微博二维码的功能

作者:匿名 字体:[增加 减小] 来源:互联网 时间:2018-12-03

本文主要包含html5,分享到微信好友,,QQ空间,微博二维码等相关知识,匿名希望在学习及工作中可以帮助到您
这篇文章主要介绍了HTML5实现分享到微信好友朋友圈QQ好友QQ空间微博二维码功能的实例代码,非常不错,具有参考借鉴价值,需要的朋友可以参考下

这是分享按钮:

<button onclick="call()">通用分享</button>
<button onclick="call('wechatFriend')">微信好友</button>
<button onclick="call('wechatTimeline')">朋友圈</button>
<button onclick="call('qqFriend')">QQ</button>
<button onclick="call('qZone')">QQ空间</button>
<button onclick="call('weibo')">微博</button>

这是js调用代码:

<script type="text/javascript" src="NativeShare.js"></script>
<script type="text/javascript">
    var nativeShare = new NativeShare()
    var shareData = {
        title: '分享标题',
        desc: '',
        // 如果是微信该link的域名必须要在微信后台配置的安全域名之内的。
        link: 'https://www.baidu.com',
        icon: 'https://www.baidu.com',
        // 不要过于依赖以下两个回调,很多浏览器是不支持的
        success: function() {
            console.log("success")
        },
        fail: function() {
            console.log("fail")
        }
    }
    nativeShare.setShareData(shareData)
    function call(command) {
        try {
            nativeShare.call(command)
        } catch (err) {
            // 如果不支持,你可以在这里做降级处理
            alert(err.message)
            // console.log("err.message")
        }
    }
</script>

这个就是分享js文件NativeShare.js:

!function(e,t){
"object"==typeof exports&&"object"==typeof module?module.exports=t():
"function"==typeof define&&define.amd?define([],t):
"object"==typeof exports?exports["NativeShare.js"]=t():
e["NativeShare.js"]=t()}(this,function(){return function(e){function t(r){
if(n[r])return n[r].exports;
var o=n[r]={i:r,l:!1,exports:{}};
return e[r].call(o.exports,o,o.exports,t),o.l=!0,o.exports}
var n={};
return t.m=e,t.c=n,t.d=function(e,n,r){
t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){
var n=e&&e.__esModule?function(){
return e.default}:
function(){return e};
return t.d(n,"a",n),n},t.o=function(e,t){
return Object.prototype.hasOwnProperty.call(e,t)},
t.p="",t(t.s=0)}([function(e,t,n){"use strict";
function r(){}function o(e){
var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:
r,n=document.getElementsByTagName("script")[0],o=document.createElement("script");
o.src=e,o.async=!0,n.parentNode.insertBefore(o,n),o.onload=t}function i(e,t){
if(null==e)throw new TypeError("Cannot convert undefined or null to object");
for(var n=Object(e),r=1;
r<arguments.length;r++){
var o=arguments[r];
if(null!=o)
for(var i in o)
Object.prototype.hasOwnProperty.call(o,i)&&(n[i]=o[i])
}
return n
}
function a(e){if(se)location.href=e;else{var t=document.createElement("iframe");
t.style.display="none",t.src=e,document.body.appendChild(t),
setTimeout(function(){t&&t.parentNode&&t.parentNode.removeChild(t)},2e3)}}
function c(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=[];
for(var r in e)t?n.push(r+"="+encodeURIComponent(e[r])):n.push(r+"="+e[r]);
return n.join("&")}function u(e){var t=document.createElement("a");
return t.href=e,t.hostname}
function l(e){
Oe?Oe.content=e:document.head.insertAdjacentHTML("beforeend",'<meta name="description" content="'+e+'">')}
function f(e){
je?je.href=e:document.head.insertAdjacentHTML("beforeend",'<link rel="shortcut icon" href="'+e+'">')}
function s(e){
document.title=e
}
function p(e){
return c
({share_id:924053302,url:_e.encode(e.link),
title:_e.encode(e.title),
description:_e.encode(e.desc),
previewimageUrl:_e.encode(e.icon),
image_url:_e.encode(e.icon)})
}
function h(){
a((se?"mqqapi://share/to_fri?src_type=web&version=1&file_type=news":"
mqqapi://share/to_fri?src_type=isqqBrowser&version=1&file_type=news")+"&"+p(Se))}
function b(){a((se?"mqqapi://share/to_fri?file_type=news&src_type=web&version=1&generalpastboard=1&shareType=1&cflag=1&objectlocation=pasteboard&callback_type=scheme&callback_name=QQ41AF4B2A":"
mqqapi://share/to_qzone?src_type=isqqBrowser&version=1&file_type=news&req_type=1")+"&"+p(Se))}
function y(){
var e={url:Se.link,title:Se.title,pic:Se.icon,desc:Se.desc};
location.href=" 
function d(){
var e={url:Se.link,title:Se.title,pic:Se.icon};
location.href=" 
function w(e,t){
if(!(e instanceof t))
throw new TypeError("Cannot call a class as a function")}
function v(e,t,n){
return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}
function g(e,t){
if(!(e instanceof t))
throw new TypeError("Cannot call a class as a function")}
function m(e,t){
if(!e)
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
return!t||"object"!=typeof t&&"function"!=typeof t?e:t}
function _(e,t){
if("function"!=typeof t&&null!==t)
throw new TypeError("Super expression must either be null or a function, not "+typeof t);
e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),
t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function O(e,t,n){
return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}
function j(e,t){
if(!(e instanceof t))
throw new TypeError("Cannot call a class as a function")}
function S(e,t){
if(!e)
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
return!t||"object"!=typeof t&&"function"!=typeof t?e:t}
function k(e,t){
if("function"!=typeof t&&null!==t)
throw new TypeError("Super expression must either be null or a function, not "+typeof t);
e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),
t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function P(e,t,n){
return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}
function C(e,t){
if(!(e instanceof t))
throw new TypeError("Cannot call a class as a function")}
function q(e,t){
if(!e)
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
return!t||"object"!=typeof t&&"function"!=typeof t?e:t}
function T(e,t){
if("function"!=typeof t&&null!==t)
throw new TypeError("Super expression must either be null or a function, not "+typeof t);
e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),
t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function E(e,t){
if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}
function D(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
return!t||"object"!=typeof t&&"function"!=typeof t?e:t}
function x(e,t){
if("function"!=typeof t&am
  


 

您可能想查找下面的文章:

  • HTML5知识点总结
  • HTML5的本地存储
  • HTML5本地存储之IndexedDB
  • Html5实现文件异步上传功能
  • Html5新标签datalist实现输入框与后台数据库数据的动态匹配
  • 详解HTML5 window.postMessage与跨域
  • HTML5拖放API实现拖放排序的实例代码
  • 解决html5中video标签无法播放mp4问题的办法
  • HTML5新特性 多线程(Worker SharedWorker)
  • Html5新增标签有哪些

相关文章

  • 2017-08-06实例讲解使用HTML5 Canvas绘制阴影效果的方法
  • 2018-12-03腾讯为什么要做网页版微信?
  • 2018-12-03解析HTML5的存储功能和web SQL的相关操作方法_html5教程技巧
  • 2018-12-03HTML5全屏(Fullscreen)API详细介绍_html5教程技巧
  • 2018-12-03HTML5中的aside标签怎么用?HTML5aside侧边栏的具体使用方法你知道吗?
  • 2018-12-03HTML5中关于History模式的详解
  • 2018-12-03用css3实现打点效果实例讲解
  • 2018-12-03HTML5游戏开发-Box2dWeb应用(一)-创建各种各样的刚体
  • 2018-12-03HTML5本地存储之localStorage、sessionStorage的具体分析
  • 2018-12-03html5 Canvas画图教程(4)—未闭合的路径及渐变色的填充方法_html5教程技巧

文章分类

  • html/xhtml
  • html5
  • CSS
  • XML/XSLT
  • Dreamweaver教程
  • Frontpage教程
  • 心得技巧
  • bootstrap
  • vue
  • AngularJS
  • HBuilder教程
  • css3
  • 浏览器兼容
  • div/css
  • 网页编辑器
  • axure

最近更新的内容

    • Medium 主页类似 iOS 7 live blur 的高斯模糊效果是如何实现的?
    • h5实现QQ聊天气泡的实例介绍
    • HTML5 WebApp part4:使用 Web Workers 来加速您的移动 Web 应用程序(下) ...
    • HTML5画渐变背景图片并自动下载实现步骤_html5教程技巧
    • 极简的HTML5模版_html5教程技巧
    • 毫无排版和缩进的 JavaScript 代码,怎么阅读?
    • html5 Canvas基本特性的示例代码分享
    • 如何使用插件数字滚动插件numberAnimate.js?
    • 在HTML5 Canvas中放入图片和保存为图片的方法
    • HTML 5的革新:结构之美

关于我们 - 联系我们 - 免责声明 - 网站地图

©2020-2025 All Rights Reserved. linkedu.com 版权所有