Joke Collection Website - Cold jokes - How to share content with friends through js code in web pages?

How to share content with friends through js code in web pages?

the WeixinJSBridge object has been added to the built-in browser of wechat, and the content can be shared with friends through the cited object, so the following code is only valid in the built-in browser of wechat. var? shareToWeixinFriend? =? function(data,? cb)

{

if? (typeof? WeixinJSBridge? ==? 'undefined')? {

return? false;

}

else? {

WeixinJSBridge.invoke('shareTimeline',? {

'img_url':? data.imgurl? ||? '',? //? Image url address

'link':? data.url,? //? The address of the article. After sharing this content in the circle of friends, you can click to jump to this address

'desc':? data.desc,

'title':? data.title

},? function(d)? {

//? Returns the value of res.err_msg, and another attribute of d is err_desc

//? share_timeline:cancel? User canceled

//? Share_timeline:fail sending failed

//? share_timeline:confirm? Sending succeeded

WeixinJSBridge.log(d.err_msg);

cb? & & ? cb(d.err_msg);

});

}

return? false;

}

In addition, in the built-in browser of WeChat, you can directly view the information of a micro signal through the weixin:// link, for example: < a? href="weixin://profile/gh_9261dce78e9f"> Dig a joke <; /a>

where gh_9261dce78e9f is a micro signal.