HTML5实现分享各大微信QQ等交流平台二维码功能

本文主要介绍了html5实现分享到微信好友朋友圈qq好友qq空间微博二维码功能的实例代码,非常不错,具有参考借鉴价值,需要的朋友可以参考下,希望能帮助到大家。

这是分享按钮:

 这是js调用代码:

    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")        }    }

这个就是分享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;r1&&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",'')}function f(e){je?je.href=e:document.head.insertAdjacentHTML("beforeend",'')}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="http://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?"+c(e,!0)}function d(){var e={url:Se.link,title:Se.title,pic:Se.icon};location.href="http://service.weibo.com/share/share.php?"+c(e,!0)}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&&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 Q(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 N(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 A(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function U(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 B(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 R(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function W(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 I(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 z(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function F(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 L(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 Z(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function J(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 H(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 X(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function G(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 V(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Y(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 ee(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function te(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 ne(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 re(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function oe(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 ie(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)}Object.defineProperty(t,"__esModule",{value:!0});var ae,ce=navigator.userAgent,ue=/(iPad).*OS\s([\d_]+)/.test(ce),le=/(iPod)(.*OS\s([\d_]+))?/.test(ce),fe=!ue&&/(iPhone\sOS)\s([\d_]+)/.test(ce),se=ue||le||fe,pe=/(Android);?[\s\/]+([\d.]+)?/.test(ce),he=/micromessenger/i.test(ce),be=/QQ\/([\d\.]+)/.test(ce),ye=/Qzone\//.test(ce),de=/MQQBrowser/i.test(ce)&&!he&&!be,we=/UCBrowser/i.test(ce),ve=/mobile.*baidubrowser/i.test(ce),ge=/SogouMobileBrowser/i.test(ce),me=/baiduboxapp/i.test(ce),_e={_keyStr:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",encode:function(e){var t,n,r,o,i,a,c,u="",l=0;for(e=_e._utf8_encode(e);l>2,i=(3&t)<>4,a=(15&n)<>6,c=63&r,isNaN(n)?a=c=64:isNaN(r)&&(c=64),u=u+this._keyStr.charAt(o)+this._keyStr.charAt(i)+this._keyStr.charAt(a)+this._keyStr.charAt(c);return u},_utf8_encode:function(e){e=e.replace(/\r\n/g,"\n");for(var t="",n=0;n<e.length;n++){var r=e.charCodeAt(n);r127&&r>6|192),t+=String.fromCharCode(63&r|128)):(t+=String.fromCharCode(r>>12|224),t+=String.fromCharCode(r>>6&63|128),t+=String.fromCharCode(63&r|128))}return t}},Oe=document.querySelector("meta[name=description]"),je=document.querySelector("link[rel*=icon]"),Se={link:location.href,title:function(){return document.title}(),desc:function(){return Object(Oe).content||""}(),icon:function(){return Object(je).href||location.protocol+"//"+location.hostname+"/favicon.ico"}(),from:"",success:r,fail:r,trigger:r},ke=function(){function e(e,t){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:{};i(this._shareData,e),this._config.syncDescToTag&&l(this._shareData.desc),this._config.syncIconToTag&&f(this._shareData.icon),this._config.syncTitleToTag&&s(this._shareData.title)}},{key:"setConfig",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};i(this._config,e)}},{key:"getConfig",value:function(){return i({},this._config)}}]),e}(),Ce=Pe,qe=function(){function e(e,t){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:"default",t=arguments[1];this.setShareData(t);var n=this.getShareData(),r=this.constructor.commamdMap[String(e).toLowerCase()];browser.app.share({title:n.title,description:n.desc,url:n.link,img_url:n.icon,from:n.from,to_app:r})}}]),t}(Ce);Te.commamdMap=(ae={},v(ae,"wechattimeline",8),v(ae,"wechatfriend",1),v(ae,"qqfriend",4),v(ae,"qzone",3),v(ae,"weibo",11),v(ae,"copyurl",10),v(ae,"more",5),v(ae,"generateqrcode",7),v(ae,"default",void 0),ae);var Ee,De=Te,xe=function(){function e(e,t){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:"default",t=arguments[1];this.setShareData(t);var n=this.getShareData(),r=this.constructor.commamdMap[String(e).toLowerCase()];ucbrowser.web_shareEX?ucbrowser.web_shareEX(JSON.stringify({title:n.title,content:n.desc,sourceUrl:n.link,imageUrl:n.icon,source:n.from,target:r})):ucbrowser.web_share(title,desc,link,r,"",from,"")}}]),t}(Ce);Qe.commamdMap=(Ee={},O(Ee,"wechattimeline","kWeixinFriend"),O(Ee,"wechatfriend","kWeixin"),O(Ee,"qqfriend","kQQ"),O(Ee,"qzone","kQZone"),O(Ee,"weibo","kSinaWeibo"),O(Ee,"default",void 0),Ee);var Me,Ne=Qe,Ae=function(){function e(e,t){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:"default",t=arguments[1];this.setShareData(t);var n=this.getShareData(),r=this.constructor.commamdMap[String(e).toLowerCase()];ucweb.startRequest("shell.page_share",[n.title,n.desc,n.link,r,"",n.from,n.icon])}}]),t}(Ce);Ue.commamdMap=(Me={},P(Me,"wechattimeline","WechatTimeline"),P(Me,"wechatfriend","WechatFriends"),P(Me,"qqfriend","QQ"),P(Me,"qzone","Qzone"),P(Me,"weibo","SinaWeibo"),P(Me,"default",""),Me);var Be=Ue,Re=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),We=function(e){function t(e){return E(this,t),D(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e))}return x(t,e),Re(t,[{key:"call",value:function(e,t){this.setShareData(t);var n=this.getShareData();_flyflowNative.exec("bd_utils","shareWebPage",JSON.stringify({title:n.title,content:n.desc,landurl:n.link,imageurl:n.icon,shareSource:n.from}),"")}}]),t}(Ce),Ie=We,ze=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),Fe=function(e){function t(e){return Q(this,t),M(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e))}return N(t,e),ze(t,[{key:"call",value:function(e,t){this.setShareData(t);var n=this.getShareData();location.href="baidubrowserapp://bd_utils?action=shareWebPage&params="+encodeURIComponent(JSON.stringify({title:n.title,content:n.desc,imageurl:n.icon,landurl:n.link,mediaType:0,share_type:"webpage"}))}}]),t}(Ce),Le=Fe,Ze=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),Je=function(e){function t(e){return A(this,t),U(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e))}return B(t,e),Ze(t,[{key:"call",value:function(e,t){this.setShareData(t);var n=this.getShareData();SogouMse.Utility.shareWithInfo({shareTitle:n.title,shareContent:n.desc,shareImageUrl:n.icon,shareUrl:n.link})}}]),t}(Ce),He=Je,Xe=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),Ge=function e(t,n,r){null===t&&(t=Function.prototype);var o=Object.getOwnPropertyDescriptor(t,n);if(void 0===o){var i=Object.getPrototypeOf(t);return null===i?void 0:e(i,n,r)}if("value"in o)return o.value;var a=o.get;if(void 0!==a)return a.call(r)},Ke=function(e){function t(e){R(this,t);var n=W(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.setConfig(e),n}return I(t,e),Xe(t,[{key:"call",value:function(e,t){this.setShareData(t)}},{key:"setConfig",value:function(e){Ge(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"setConfig",this).call(this,e),this.init(this.getConfig().wechatConfig)}},{key:"init",value:function(e){var t=this;e&&o("https://res.wx.qq.com/open/js/jweixin-1.2.0.js",function(){wx.config(i({debug:!1,jsApiList:["onMenuShareTimeline","onMenuShareAppMessage","onMenuShareQQ","onMenuShareWeibo","onMenuShareQZone"]},e));var n=t._shareData,r={};Object.defineProperty(r,"trigger",{get:function(){return function(){i(r,{title:n.title,desc:n.desc,link:n.link,imgUrl:n.icon,type:n.type,dataUrl:n.dataUrl,success:n.success,fail:n.fail,cancel:n.fail}),n.trigger.apply(n,arguments)}},set:function(e){n.trigger=e},enumerable:!0}),wx.ready(function(){wx.onMenuShareAppMessage(r),wx.onMenuShareQQ(r),wx.onMenuShareQZone(r),wx.onMenuShareWeibo(r),wx.onMenuShareTimeline(r)})})}}]),t}(Ce),Ve=Ke,Ye=function(){function e(e,t){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:"default",t=arguments[1];if(this.setShareData(t),"weibo"!==(e=String(e).toLowerCase()))throw"qqfriend"===e?h():"qzone"===e&&b(),new Error("the browser may not support command "+e+"!");d()}}]),t}(Ce),et=$e,tt=function(){function e(e,t){for(var n=0;n0&&void 0!==arguments[0]&&arguments[0],arguments[1]);this.setShareData(e),mqq.ui.showShareMenu()}},{key:"init",value:function(){var e=this;o("https://open.mobile.qq.com/sdk/qqapi.js",function(){var t=e._shareData;mqq.ui.setOnShareHandler(function(e){mqq.ui.shareMessage({back:!0,share_type:e,title:t.title,desc:t.desc,share_url:t.link,image_url:t.icon,sourceName:t.from},function(e){0===e.retCode?t.success(e):t.fail(e)})})})}}]),t}(Ce),rt=nt,ot=function(){function e(e,t){for(var n=0;n0&&void 0!==arguments[0]&&arguments[0],arguments[1]);this.setShareData(e),mqq.ui.showShareMenu()}},{key:"init",value:function(){var e=this;o("https://open.mobile.qq.com/sdk/qqapi.js",function(){e.setShareData()})}}]),t}(Ce),ct=at,ut=function(){function e(e,t){for(var n=0;n0&&void 0!==arguments[0]&&arguments[0],arguments[1]);this.setShareData(t);for(var n=this.getShareData(),r=[],o=[],i=[],a=[],c=0;c<5;c++)r.push(n.icon),a.push(n.link),o.push(n.title),i.push(n.desc);QZAppExternal.setShare(function(t){0!=t.code&&(e.hasSomethingWrong=!0)},{type:"share",image:r,title:o,summary:i,shareURL:a})}},{key:"setShareData",value:function(e){try{this.call("default",e)}catch(e){}}},{key:"init",value:function(){var e=this;o("https://qzonestyle.gtimg.cn/qzone/phone/m/v4/widget/mobile/jsbridge.js",function(){e.call("default")})}}]),t}(Ce),ft=lt,st=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),pt=function(e){function t(e){return ee(this,t),te(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e))}return ne(t,e),st(t,[{key:"call",value:function(e,t){this.setShareData(t);var n=this.getShareData();window.NativeShareFailCallback=n.fail,window.NativeShareSuccessCallback=n.success,location.href="baiduboxapp://callShare?"+["options="+encodeURIComponent(JSON.stringify({title:n.title,imageUrl:"",mediaType:"all",content:n.desc,linkUrl:n.link,iconUrl:n.icon})),"errorcallback=window.NativeShareFailCallback","successcallback=window.NativeShareSuccessCallback"].join("&")}}]),t}(Ce),ht=pt,bt=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),yt=function(e){function t(e){return re(this,t),oe(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e))}return ie(t,e),bt(t,[{key:"call",value:function(e,t){this.setShareData(t);var n=this.getShareData();window.NativeShareFailCallback=n.fail,window.NativeShareSuccessCallback=n.success,prompt("BdboxApp:"+JSON.stringify({obj:"Bdbox_android_utils",func:"callShare",args:['{\n                            imageUrl: "",\n                            mediaType: "all",\n                            title: "'+n.title+'",\n                            content: "'+n.desc+'",\n                            linkUrl: "'+n.link+'",\n                            iconUrl: "'+n.icon+'"\n                        }',"window.NativeShareSuccessCallback","window.NativeShareFailCallback"]}))}}]),t}(Ce),dt=yt;n.d(t,"Share",function(){return Ce}),n.d(t,"QQMobileBrowser",function(){return De}),n.d(t,"UCIosBrowser",function(){return Ne}),n.d(t,"UCAndroidBrowser",function(){return Be}),n.d(t,"BaiduAndroidBrowser",function(){return Ie}),n.d(t,"BaiduIosBrowser",function(){return Le}),n.d(t,"SogouIosBrowser",function(){return He}),n.d(t,"BaiduIos",function(){return ht}),n.d(t,"BaiduAndroid",function(){return dt}),n.d(t,"Wechat",function(){return Ve}),n.d(t,"Others",function(){return et}),n.d(t,"QQIos",function(){return rt}),n.d(t,"QQAndroid",function(){return ct}),n.d(t,"QZone",function(){return ft}),n.d(t,"shareToQQ",function(){return h}),n.d(t,"shareToQZone",function(){return b}),n.d(t,"shareToWeibo4Web",function(){return d}),n.d(t,"shareToQZone4Web",function(){return y});var wt=void 0;wt=he?Ve:be&&se?rt:be&&pe?ct:ye?ft:de?De:we&&se?Ne:we&&pe?Be:ve&&pe?Ie:ve&&se?Le:ge&&se?He:me&&se?ht:me&&pe?dt:et,window.NativeShare=wt,t.default=wt}])});

大家学会了吗?赶紧动手尝试一下吧。

立即学习“前端免费学习笔记(深入)”;

相关推荐:

HTML5混合开发二维码扫描以及调用本地摄像头实例教程

PHP如何实现二维码识别-实例分享

php二维码的生产以及下载方法

以上就是HTML5实现分享各大微信QQ等交流平台二维码功能的详细内容,更多请关注创想鸟其它相关文章!

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。
如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件至 chuangxiangniao@163.com 举报,一经查实,本站将立刻删除。
发布者:程序猿,转转请注明出处:https://www.chuangxiangniao.com/p/1545433.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2025年12月21日 16:59:35
Dreamweaver网页制作使用css样式嵌套方法
下一篇 2025年12月21日 16:59:48

相关推荐

  • PHP播放HLS视频流的方法_PHP播放HLS视频流方法

    答案:PHP通过权限控制和文件代理实现HLS流安全分发,前端使用HTML5视频标签和hls.js播放。具体描述:HLS将视频切为.ts片段并用.m3u8索引,PHP后端可校验用户权限、防止盗链,动态输出.m3u8或.ts内容;前端通过video标签加载stream.php?id=1,结合hls.js…

    2026年9月20日
    000
  • 悟空浏览器为什么玩网页游戏很卡_悟空浏览器网页游戏卡顿原因

    1、清理缓存与数据;2、关闭后台应用;3、禁用非必要插件;4、优化网络DNS;5、启用硬件加速。通过五步优化可有效缓解悟空浏览器网页游戏卡顿问题。 如果您在使用悟空浏览器玩网页游戏时遇到卡顿现象,可能是由于浏览器资源占用过高、缓存堆积或网络连接不稳定所致。此类问题通常可以通过调整浏览器设置和优化系统…

    2026年9月11日
    100
  • VSCode怎么编译运行视频_VSCode处理视频资源的扩展配置教程

    VSCode不能编译运行视频,但可通过脚本和扩展集成FFmpeg等工具实现视频转码、剪辑、元数据提取及自动化处理,扮演视频工作流的“指挥中心”角色。 VSCode本身并不是一个视频播放器或专业的视频编辑软件,所以“编译运行视频”这个说法,在我个人看来,其实是有些误解的。它不会像C++代码那样被编译成…

    2026年9月11日
    100
  • 百度浏览器无法播放YouTube视频怎么办 百度浏览器YouTube播放问题解决方法

    百度浏览器无法播放YouTube视频,通常与浏览器兼容性、缓存问题或系统设置有关。可以尝试以下几种方法来解决。 清除浏览器缓存和Cookie 过时或损坏的缓存数据可能导致YouTube页面加载异常或视频无法播放。 打开百度浏览器,点击右上角菜单(三个横线或点)。 选择“更多工具” > “清除上…

    2026年9月10日
    200
  • VSCode代码片段:快速生成常用代码

    VSCode代码片段是通过触发词快速生成代码模板的功能,支持自定义占位符与变量。以JavaScript为例,可通过命令面板配置javascript.json文件,添加如”logf”生成带日志函数的代码块,${1}${2}为占位符,$0为最终光标位置。推荐创建React组件、E…

    2026年9月9日
    000
  • PHP视频播放器音量控制_PHP视频播放器音量控制

    音量控制由前端实现,PHP提供数据支持。HTML5视频标签结合JavaScript实现音量调节,PHP负责存储用户偏好、权限管理和动态生成初始音量配置,实现个性化播放体验。 在使用PHP开发视频播放应用时,音量控制功能通常不是由PHP本身直接实现的,因为PHP是服务器端语言,而音量控制属于前端交互功…

    2026年9月9日
    200
  • 小米将于 9 月和 10 月发布两款平板 最高搭载骁龙 8 平台

    小米将于 9 月和 10 月发布两款平板 最高搭载骁龙 8 平台小米将于 9 月和 10 月发布两款平板 最高搭载骁龙 8 平台小米将于 9 月和 10 月发布两款平板 最高搭载骁龙 8 平台小米将于 9 月和 10 月发布两款平板 最高搭载骁龙 8 平台

    近日,有博主在社交平台上透露,小米将在9月和10月分别推出两款平板新品,且均将采用高通骁龙平台。其中,红米 redmi pad 2 pro 预计将搭载骁龙 7s 移动平台(可能为第四代),而小米平板 8 系列则将升级至旗舰级的骁龙 8 系平台,或为最新的骁龙 8 至尊版。 小米平板 7 据CNMO了…

    2026年9月9日 用户投稿
    200
  • 百度浏览器Flash无法播放怎么办 百度浏览器Flash内容播放异常处理方法

    Flash技术已终结,因Adobe于2020年底停止支持,百度浏览器等主流平台均禁用,继续使用存安全风险;应转向HTML5等现代技术,仅在隔离环境中运行必要本地文件。 百度浏览器无法播放Flash,核心原因是技术过时和插件支持终止。虽然部分旧方法可能临时奏效,但需明确:Adobe已于2020年12月…

    2026年9月9日
    200
  • PHP播放本地视频文件路径怎么写_PHP播放本地视频路径技巧

    答案:PHP通过生成HTML5视频标签间接实现本地视频播放,视频文件需置于Web可访问目录,使用绝对路径避免错误,通过标签嵌入并由浏览器播放,结合htmlspecialchars()防XSS,敏感视频可移出Web目录由PHP脚本验证权限后代理输出,确保安全。 在PHP中播放本地视频文件,关键不在于P…

    2026年9月9日
    200
  • 谷歌浏览器为什么无法播放HTML5视频_谷歌浏览器视频播放异常排查方法

    首先检查并更新谷歌浏览器至最新版本,随后清除浏览器及GPU缓存,禁用硬件加速功能以排除显卡驱动兼容问题,确认视频格式为MP4、WebM等支持类型并采用H.264+AAC编码组合,重置chrome://flags实验性设置与浏览器默认配置,最后关闭扩展程序排查拦截风险并确保跨域资源具备正确CORS头。…

    2026年9月8日
    100
  • HTML视频元素使用指南

    1、随着html5的推出,新增了video元素,使得网页具备了原生播放视频的能力。在此之前,网页无法直接嵌入视频,通常需要借助第三方插件(例如flash)来实现播放功能。用户必须预先在浏览器中安装这些插件才能正常观看视频内容,若未安装,则视频无法加载或播放。这种依赖外部插件的方式不仅影响兼容性,也降…

    2026年9月7日
    000
  • Safari网页版入口 Safari直接打开

    Safari网页版可通过官网https://www.apple.com/safari/直接访问,支持跨平台浏览,页面加载快且适配多语言;具备节能、防跟踪、支持现代网页标准等技术优势,并与Apple生态无缝集成,提供简洁界面、阅读器模式和手势导航等优质用户体验。 Safari网页版入口 Safari直…

    2026年9月3日
    200
  • VSCode怎么编写地图定位_VSCode集成地图API开发位置服务应用教程

    答案是集成地图API实现定位需选择服务商、引入SDK、初始化地图并调用定位功能。具体为:在VSCode中创建Web项目,引入百度等地图API的SDK,通过HTML页面加载地图容器,使用JavaScript初始化地图实例,并结合浏览器Geolocation API或地图SDK自带控件获取位置,最后添加…

    2026年8月29日
    100
  • 推荐几款好用的文本编辑器

    推荐几款好用的文本编辑器推荐几款好用的文本编辑器推荐几款好用的文本编辑器推荐几款好用的文本编辑器

    作为程序员,编写和查看代码是日常工作的重要部分。今天,我将为大家介绍几款实用的文本编辑器。 Sublime Text 是一款轻量、简洁、高效且跨平台的编辑器。 Sublime Text的特色功能包括: 出色的扩展功能,官方称为安装包(Package)。它没有传统的右侧滚动条,而是用代码缩略图代替,这…

    2026年8月28日 用户投稿
    300
  • b站视频怎么镜像翻转_B站视频画面镜像处理技巧

    1、使用B站手机客户端可直接开启镜像翻转:进入全屏播放后点击右上角三个点,选择【镜像翻转】即可实时切换画面方向。2、通过B站网页版HTML5播放器也可实现:在电脑端播放视频时点击设置齿轮,开启【镜像画面】开关即生效。3、如需永久保存镜像效果,可借助剪映等剪辑软件对视频进行水平翻转处理后再导出使用。 …

    2026年8月28日
    100
  • VSCode怎么调出HTML模板_VSCode快速生成HTML基础模板结构教程

    答案:在VSCode中输入!后按Tab键即可快速生成HTML5模板,也可使用html:5或doc等Emmet缩写,若失效需检查文件类型和设置,还可通过自定义snippets.json实现个性化模板。 在VSCode中快速生成HTML基础模板结构,最直接也最常用的方法就是利用其内置的Emmet功能。你…

    2026年8月26日
    200
  • UC浏览器视频小窗播放怎么用_UC浏览器视频小窗播放方法

    在UC浏览器播放视频时,按返回键或滑动退出可启用小窗模式;02. 若未自动开启,可通过菜单手动选择“小窗播放”;03. 小窗支持拖动、缩放与手势控制,便于多任务操作。 如果您在观看视频时希望同时浏览其他内容,可以使用UC浏览器的视频小窗播放功能,让视频以悬浮窗口的形式继续播放。该功能适用于移动端操作…

    2026年8月26日
    000
  • VSCode怎么自动生成HTML_VSCode快速生成HTML基础模板结构教程

    输入!按Tab即可生成HTML5模板,VSCode通过Emmet实现高效编码,支持自定义片段和高级缩写,提升开发效率。 说实话,刚开始用VSCode写HTML的时候,我也觉得每次都要手动敲 、 、 那些东西挺麻烦的。后来才发现,VSCode在快速生成HTML基础模板结构这方面做得真是相当到位,主要就…

    2026年8月26日
    000
  • 如何解决PHP中复杂的HTML/XML解析与操作问题,arthurkushman/query-path助你轻松驾驭!

    可以通过一下地址学习composer:学习地址 告别繁琐:PHP 处理 HTML/XML 的痛与思 在日常的 php 开发中,我们经常需要与各种 html 或 xml 文档打交道。无论是从第三方网页抓取信息,还是处理复杂的 xml 配置,亦或是动态生成和修改 html 片段,这些任务都不可避免。然而…

    用户投稿 2026年8月26日
    100
  • 手把手教你用 transition 实现短视频 APP的点赞动画

    手把手教你用 transition 实现短视频 APP的点赞动画手把手教你用 transition 实现短视频 APP的点赞动画手把手教你用 transition 实现短视频 APP的点赞动画手把手教你用 transition 实现短视频 APP的点赞动画

    怎么使用纯 css 实现有趣的点赞动画?下面本篇文章就带大家了解一下巧妙借助 transition实现点赞动画的方法,希望对大家有所帮助! 在各种短视频界面上,我们经常会看到类似这样的点赞动画: 非常的有意思,有意思的交互会让用户更愿意进行互动。 那么,这么有趣的点赞动画,有没有可能使用纯 CSS …

    2025年12月24日 用户投稿
    100

发表回复

登录后才能评论
关注微信