Share the js Code and js Code on WeChat

Source: Internet
Author: User

Share a friend's link to display js Code and js Code

Normally, when I want to share a page like a friend, do I want the title and description of the display? I checked some information and originally controlled it through js.

The results are as follows:

Titles, descriptions, and shared images are controlled by js.

The js Code is as follows:

<Script> var dataForWeixin = {appId: "", MsgImg :" http://www.yyychina.com/Christmas/201012189457639.gif ", // Display image TLImg :" http://www.yyychina.com/Christmas/201012189457639.gif ", // Show image url :" http://www.yyychina.com/Christmas/6.html?stra=!u738B!u4F1F ", // Jump address title:" I miss you and wish you a Merry Christmas ", // The title content desc: "send you my thoughts and wishes, and wish you a merry Christmas.", // Description: fakeid: "", callback: function () {}}; (function () {var onBridgeReady = function () {WeixinJSBridge. on ('menu: share: appmessage', function (argv) {WeixinJSBridge. invoke ('sendappmessage', {"appid": dataForWeixin. appId, "img_url": dataForWeixin. msgImg, "img_width": "120", "img_height": "120", "link": dataForWeixin. url, "desc": dataForWeixin. desc, "title": dataForWeixin. title}, function (res) {(dataForWeixin. callback) () ;}); WeixinJSBridge. on ('menu: share: timeline ', function (argv) {(dataForWeixin. callback) (); WeixinJSBridge. invoke ('effectimeline', {"img_url": dataForWeixin. TLImg, "img_width": "120", "img_height": "120", "link": dataForWeixin. url, "desc": dataForWeixin. desc, "title": dataForWeixin. title}, function (res) {}) ;}); WeixinJSBridge. on ('menu: share: weibo ', function (argv) {WeixinJSBridge. invoke ('incluweio ', {"content": dataForWeixin. title, "url": dataForWeixin. url}, function (res) {(dataForWeixin. callback) () ;}); WeixinJSBridge. on ('menu: share: facebook ', function (argv) {(dataForWeixin. callback) (); WeixinJSBridge. invoke ('invoke FB ', {"img_url": dataForWeixin. TLImg, "img_width": "120", "img_height": "120", "link": dataForWeixin. url, "desc": dataForWeixin. desc, "title": dataForWeixin. title}, function (res) {}) ;}; if (document. addEventListener) {document. addEventListener ('weixinjsbridgeready', onBridgeReady, false);} else if (document. attachEvent) {document. attachEvent ('weixinjsbridgeready', onBridgeReady); document. attachEvent ('onweixinjsbridgeready', onBridgeReady) ;}}) (); </script>

  

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.