简体   繁体   中英

Custom sharing Buttons

I am trying to implement social media sharing buttons on my Website. I am successfull in implementing the facebook sharing button.

My Code :

<div id="fb-root"></div>
<script>(function(d, s, id) {
  var js, fjs = d.getElementsByTagName(s)[0];
  if (d.getElementById(id)) return;
  js = d.createElement(s); js.id = id;
  js.src = "//connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.3";
  fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>

Now i can see the share button and i am able to share the required page. When i click the button another modal comes up : 在此处输入图片说明

Now i want when a user clicks the share button then a pre defined message should be there in the highlighted area. How can i acheive this here and also in LinkedIn, Twitter and Google+ buttons.

Do i have to use Open Graph Protocol for this? If yes then can anybody post an article regarding this or tell me how can i achieve this using OG.

Prefilling the message is not allowed on Facebook, and it´s not possible anyway. You may want to read the platform policy .

For facebook : open graph will fetch og tags for description from that link to display description in share popup.

you can set title,description,thumbnail using meta tag like this.

<meta property="og:title" content="title" />
<meta property="og:description" content="description" />
<meta property="og:image" content="thumbnail_image" />

For twitter: Go through this link see data-text .

https://dev.twitter.com/web/tweet-button/parameters

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM