Javascript: how to modify the title Content shared by WeChat _ javascript skills

Source: Internet
Author: User
This article mainly introduces how to modify and share the title content in javascript. If you need a friend, you can refer to the code which is super simple. There is not much nonsense here. Let's take a look at the comments,

Code:

The Code is as follows:


Script
// Share
Var wimg = "share image URL 123 ";
Var wurl = "share web site 123 ";
Var wdesc = 'share content 100 ';
Var wtit = 'share title 100 ';
Var wappid = '';

Function shareMsg () {// the title and content sent to a friend are displayed by default.
WeixinJSBridge. invoke ('sendappmessage ',{
"Appid": wappid,
"Img_url": wimg,
"Maid": "200 ",
"Img_heights": "200 ",
"Link": wurl,
"Desc": wdesc,
"Title": wtit,
})
}
Function other Quan () {// only the title is displayed in the circle of friends.
WeixinJSBridge. invoke ('effectimeline ',{
"Img_url": wimg,
"Maid": "200 ",
"Img_heights": "200 ",
"Link": wurl,
"Desc": wdesc,
"Title": wtit
});
}
Function compute Weibo () {// only content is displayed on Weibo.
WeixinJSBridge. invoke ('invalid weio ',{
"Content": wdesc,
"Url": wurl,
});
}
// When the built-in browser completes internal initialization, The WeixinJSBridgeReady event is triggered.
Document. addEventListener ('weixinjsbridgeready', function onBridgeReady (){
// Send it to a friend
WeixinJSBridge. on ('menu: share: appmessage', function (argv ){
ShareMsg ();
});
// Share with your friends
WeixinJSBridge. on ('menu: share: timeline ', function (argv ){
ShareQuan ();
});
// Share on Weibo
WeixinJSBridge. on ('menu: share: Weaver ', function (argv ){
ShareWeibo ();
});
}, False );
Script

Is it very practical? You can use it as needed.

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.