简体   繁体   中英

How to cusomize facebook's sharer.php to sharer images on chats and Timeline

Below is the code used to share an image in facebook:

<div><a href="#" 
  onclick="
    window.open(
      'https://www.facebook.com/sharer/sharer.php?m2w&u=[[Link to share]]&mode=message', 
      'facebook-share-dialog', 
      'width=626,height=436'); 
    return false;"><img src="send.png(the image clicking on which the sharer window will open)"></a></div>

the above code will open the facebook sharer window in private message mode. 在此输入图像描述

If we remove the &mode=message after the link to share, the sharer window will say share on your timeline. Can anyone please help me how to make the sharer window open saying 'share on a friends timeline' or 'share in a group' by default.

I'm not sure what you're asking for,

If we remove the &mode=message after the link to share, the sharer window will say share on your timeline. Can anyone please help me how to make the sharer window open saying 'share on a friends timeline' or 'share in a group' by default.

anyways if you want to show the option "Share on a friend's timeline" to be shown by default add &mode=friend to end of share dialog and for group use &mode=group

<a id="share" href="#" data-share="https://www.facebook.com/sharer/sharer.php?m2w&u=http://flatuicolors.com/&mode=group" class="groupBtn">Share in Group</a>

<a id="share" href="#" data-share="https://www.facebook.com/sharer/sharer.php?m2w&u=http://flatuicolors.com/&mode=friend" class="friendBtn">Share on Friend's Timeline</a>

Here's an example http://jsfiddle.net/AdamAzad/Lm2sc/

为了通过私人消息“共享”添加&mode =消息

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