Home > Web Front-end > JS Tutorial > body text

Javascript implements modifying the title content shared by WeChat_javascript skills

WBOY
Release: 2016-05-16 16:27:37
Original
1562 people have browsed it

The code is super simple, no more nonsense here, friends, just read the comments yourself,

Provide the code:

Copy code The code is as follows:

<script><br> //WeChat sharing<br> var wimg = "Share picture URL 123";<br> var wurl = "Share URL 123";<br> var wdesc = 'Share content 123';<br> var wtit = 'Share title 123';<br> var wappid = '';<br> <br> function shareMsg() {//<span style="font-family: Arial, Helvetica, sans-serif;">Send to friends</span><span style="font-family: Arial, Helvetica, sans-serif;">Both title and content are displayed by default</span><br> WeixinJSBridge.invoke('sendAppMessage',{<br> "appid": wappid,<br> “img_url”: wimg,<br> "img_width": "200",<br> "img_height": "200",<br> "link": wurl,<br> "desc": wdesc,<br> "title": wtit,<br> })<br> }<br> function shareQuan() { //<span style="font-family: Arial, Helvetica, sans-serif;">When sharing to Moments, only the title will be displayed</span><br> WeixinJSBridge.invoke('shareTimeline',{<br> “img_url”: wimg,<br> "img_width": "200",<br> "img_height": "200",<br> "link": wurl,<br> "desc": wdesc,<br> "title": wtit<br> });<br> }<br> function shareWeibo() { <span style="font-family: Arial, Helvetica, sans-serif;">//</span><span style="font-family: Arial, Helvetica, sans-serif ;">Share to Weibo and only the content will be displayed</span><br> WeixinJSBridge.invoke('shareWeibo',{<br> "content": wdesc,<br> "url": wurl,<br> });<br> }<br> // When WeChat's built-in browser completes internal initialization, the WeixinJSBridgeReady event will be triggered. <br> document.addEventListener('WeixinJSBridgeReady', function onBridgeReady() {<br> //Send to friends<br> WeixinJSBridge.on('menu:share:appmessage', function(argv){<br>          shareMsg();<br> });<br> // Share to Moments<br> WeixinJSBridge.on('menu:share:timeline', function(argv){<br>         shareQuan();<br> });<br> // Share to Weibo<br> WeixinJSBridge.on('menu:share:weibo', function(argv){<br>         shareWeibo();<br> });<br> }, false);<br> </script>

Isn’t it very practical? Friends, please use it according to your own needs.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template