29

Question:

I need to pass my content like title, summary and image in a Facebook sharer URL like this:

 <a id="button"
    href="http://www.facebook.com/sharer.php?
    s=100
    &p[url]=http://myurl.com/overview/sap-talent
    &p[images][0]=http://myurl/images/my_image.png
    &p[title]=mytitle
    &p[summary]=containsummary">

The problem is it's automatically getting some content from the above mentioned URL (http://myurl.com/overview/sap-talent), and I don't know where my title and summary data are gone. Is there another way to share my custom title, summary and image via facebooksharer.php?

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
kamesh
  • 2,374
  • 3
  • 25
  • 33
  • 1
    [How to use og meta tags for facebook share](http://stackoverflow.com/questions/11616697/how-to-use-og-meta-tag-for-facebook-share) Could be use. – Darren Mar 26 '14 at 05:16
  • @dbh I used og meta tag but still title,summary and image what im trying to pass is not showing ? – kamesh Mar 26 '14 at 05:25

6 Answers6

34

Looks like Facebook disabled passing parameters to the sharer.

We have changed the behavior of the sharer plugin to be consistent with other plugins and features on our platform.

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.

Here's the URL to the post: https://developers.facebook.com/x/bugs/357750474364812/

Community
  • 1
  • 1
Robert Oates
  • 356
  • 2
  • 2
24

The only parameter you need right now is ?u=<YOUR_URL>. All other data will be fetched from page or (better) from your open graph meta tags:

<meta property="og:url"                content="http://www.nytimes.com/2015/02/19/arts/international/when-great-minds-dont-think-alike.html" />
<meta property="og:type"               content="article" />
<meta property="og:title"              content="When Great Minds Don’t Think Alike" />
<meta property="og:description"        content="How much does culture influence creative thinking?" />
<meta property="og:image"              content="http://static01.nyt.com/images/2015/02/19/arts/international/19iht-btnumbers19A/19iht-btnumbers19A-facebookJumbo-v2.jpg" />

Example & description here

You can test your page for accordance in the debugger.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
vladkras
  • 16,483
  • 4
  • 45
  • 55
  • Even if the data will be fetched from the page it is still better to send the parameters if they are easily accessible, a busy website doesn't need anymore requests than it already has :) – Bodokh Jan 22 '19 at 09:41
  • @Bodokh: on the contrary. You're sending parameters that will be ignored by Facebook because it fetches them from the meta tags. Sending and receiving and then ignoring these URL parameters takes some bandwidth and CPU cycles. Not that it makes any difference, compared to watching a cat video. – Dan Dascalescu May 30 '20 at 06:17
19

This works at the moment (Oct. 2016), but I can't guarantee how long it will last:

https://www.facebook.com/sharer.php?caption=[caption]&description=[description]&u=[website]&picture=[image-url]
Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
i--
  • 4,349
  • 2
  • 27
  • 35
  • 1
    Will this work after july 10th? Because after using this method for a long time with no issues, I noticed that "sometimes" the image is not showing in the share dialog, but the image will be showed when posted in the wall. Looks like there is some kind of timeout and in case the image has not been loaded (or processed by fb) before the timeout, the image holder will be empty. But the weirdest issue of all, is that in some cases, FB is making up an OG image from the content of the site. – Tyra Pululi Jun 20 '17 at 07:21
  • The `description` and `caption` parameters seem to have no effect, but `u` still works. – Dan Dascalescu May 30 '20 at 06:15
15

It seems that the only parameter that allows you to inject custom text is the "quote".

https://www.facebook.com/sharer/sharer.php?u=THE_URL&quote=THE_CUSTOM_TEXT
Bruja
  • 368
  • 2
  • 10
5

On the Developers bugs Facebook site, the last answer about that (parameters with sharer.php), makes me believe it was a bug that was going to be resolved. Am I right?

https://developers.facebook.com/x/bugs/357750474364812/

Ibrahim Faour · · Facebook Platform Team

Apologies for the inconvenience. We aim to update our external reports as soon as we get a resolution on issues. I do understand that sometimes the answer provided may not be satisfying, but we are eager to keep our platform as stable and efficient as possible. Thanks!

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Marie
  • 51
  • 1
  • 1
3

I've used the below before, and it has worked. It isn't very pretty, but you can alter it to suit your needs.

The following JavaScript function grabs the location.href & document.title for the sharer, and you can ultimately change these.

function fbs_click() {
        u=location.href;
        t=document.title;
window.open('http://www.facebook.com/sharer.php?u='+encodeURIComponent(u)+'&t='+encodeURIComponent(t),
                'sharer',
                'toolbar=0,status=0,width=626,height=436');

            return false;
        }

Usage:

<a rel="nofollow" href="http://www.facebook.com/share.php?u=<;url>" onclick="return fbs_click()" target="_blank">
    Share on Facebook
</a>

It looks like this is what you could possibly be looking for: Facebook sharer title / desc....

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Darren
  • 13,050
  • 4
  • 41
  • 79