How to create a Tencent Weibo (qq) share button?

删除回忆录丶 提交于 2019-12-10 11:32:01

问题


I need to implement the equivalent of the Tweet button for the Chinese translation of a website, that is, not the "share on Weibo" button, which I already got (using the generator here), but a Tencent/QQ Weibo share button.

What I've done so far:

  • Subscribed to Weibo (reading the automatically Google-translated pages-I don't know Chinese)
  • tried to go to the Q-Share page (here) but the next page asks me personal info that I don't have (e.g. a Chinese telephone number, mandatory)

Are there alternative ways to do it?


回答1:


I'm not 100% sure this is the only way, but we made it work as follows.

First, it is mandatory to have a Chinese account, so ask someone in China (for example your client, or a colleague, which is what I did) to subscribe and fill in the required info. He/she will have to create and retrieve an app key (see below).

Then, add the following script tag anywhere in the page within the <body> tag (I've put it at the bottom for performance's sake):

< script src="http://mat1.gtimg.com/app/openjs/openjs.js#autoboot=no&debug=no"></script> 

Please note: there's a whitespace between < and script because SO refuses to post the answer if it contains script tags: don't forget to remove the whitespace if you copy-paste the above code.

Lastly, add the following code where you want the QQ Weibo share button to appear:

<div id="qqwb_share__" data-appkey="YOUR_APP_KEY" data-icon="0" data-counter="1" data-counter_pos="right" 
data-content="title" data-richcontent="line1|line2|line3"
data-pic="pic"></div>

You'll have to replace:

  • title with the title of the page
  • lineN with a short summary of the page
  • pic with the URL of an image

these will show up on the shared item.

  • YOUR_APP_KEY with the numeric app key assigned by QQ Weibo.


来源:https://stackoverflow.com/questions/16967666/how-to-create-a-tencent-weibo-qq-share-button

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!