How do I customize Facebook's sharer.php

后端 未结 5 648
鱼传尺愫
鱼传尺愫 2020-11-30 18:24

http://www.facebook.com/sharer/sharer.php?u=http%3A%2F%2Fwww.google.com

How can I customize the text and image. It looks like Facebook pulled the docs.

5条回答
  •  生来不讨喜
    2020-11-30 18:57

    UPDATE:

    This answer is outdated.

    Like @jack-marchetti stated in his comment, and @devantoine with the link: https://developers.facebook.com/x/bugs/357750474364812/

    Facebook has changed how the sharer.php works, as Ibrahim Faour replies to the bug filed with Facebook.

    The sharer will no longer accept custom parameters and facebook will pull the information that is being displayed in the preview the same way that it would appear on facebook as a post, from the url OG meta tags.


    Try this (via Javascript in this example):

    'http://www.facebook.com/sharer.php?s=100&p[title]='+encodeURIComponent('this is a title') + '&p[summary]=' + encodeURIComponent('description here') + '&p[url]=' + encodeURIComponent('http://www.nufc.com') + '&p[images][0]=' + encodeURIComponent('http://www.somedomain.com/image.jpg')

    I tried this quickly without the image part and the sharer.php window appears pre-populated, so it looks like a solution.

    I found this via this SO article:

    Want custom title / image / description in facebook share link from a flash app

    and this link contained in an answer from Lelis718:

    http://www.daddydesign.com/wordpress/how-to-create-a-custom-facebook-share-button-for-your-iframe-tab/

    so all credit to Lelis718 for this answer.

    [EDIT 3rd May 2013] - seems like the original URL i had here no longer works for me without also including "s=100" in the query string - no idea why but have updated accordingly

提交回复
热议问题