10

I am using this URL to share the URL, title, description and image to Facebook:

http://www.facebook.com/sharer.php?&s=100&p[url]=ENCODEDURL&p[title]=encoded TITLE&p[summary]=encoded description&p[images][0]=encoded

It works fine in desktop site, but doesn't work in the mobile site. The mobile site changes the URL to m.facebook.come/sharer.php?....

I changed the Facebook URL to m.facebook.com/sharer.php?... and passed the same parameters like title, description and image but it still doesn't work.

After searching on Google, I have come across an article that explains that we can send two parameters in the mobile version of Facebook: u for URL and t for title.

What should I do to have a similar result for users that navigate to Facebook either using a desktop or mobile device?

eggy
  • 2,836
  • 3
  • 23
  • 37
user2632021
  • 101
  • 1
  • 1
  • 4

3 Answers3

14

I just ran into this same problem, and my only solution was to force mobile users to use the desktop version of sharer.php. It looks like ass on mobiles but it functions as expected and was the best way I could find to not completely hose sharing in my app. In the end, my client would rather have working, less-aesthetically pleasing sharing than a proper mobile sharing page that was broken.

To do this, all you have to do is add a ?m2w parameter to sharer.php.

In your case:

http://www.facebook.com/sharer.php?m2w&s=100&p[url]=ENCODEDURL&p[title]=encoded TITLE&p[summary]=encoded description&p[images][0]=encoded

Scott
  • 2,753
  • 1
  • 24
  • 31
  • This isn't working for me, is it still supposed to work? – gdvalderrama Dec 04 '18 at 08:44
  • @guival have no idea, unfortunately, this answer is about 5 years old and probably no longer relevant. See the below answers for something that may work better for you. – Scott Dec 05 '18 at 10:39
3

You can use mobile version of sharer.php as there isn't any alternatives.

http://m.facebook.com/sharer.php?u=<urlencoded url>

For example:

http://m.facebook.com/sharer.php?u=http://www.example.com

Please see this question and answers too.Facebook and twitter share for mobile web

Community
  • 1
  • 1
Surabhil Sergy
  • 1,946
  • 1
  • 23
  • 40
  • This should be the accepted answer rather than forcing users to use the desktop sharer – D2TheC Apr 23 '15 at 09:58
  • @DirkConradCoetsee the OP says that the mobile version doesn't suit his needs (or at least didn't back in 2013, maybe it does now, I don't know, I haven't touched serious FB development for a couple of years). At least the desktop version I suggested allowed you (at the time) to pass description, image, etc. parameters. – Scott Apr 30 '15 at 13:09
  • @Scottie unfortunately this is no longer true. FB share ignores image and summary tags and uses OG tags instead now. Basically what I've found is that the mobile sharer works from mobile and desktop while the desktop sharer doesn't (unless you add m2w). Basically times have changed and best you can do is pass an url . This is a late 2014 change though, prior answer would have been better at the time – D2TheC May 01 '15 at 14:47
  • That's a fair point. Unfortunately I think we've seen the last of user2632021. :( – Scott May 01 '15 at 15:24
0

Since it is a web app i assume and the context is mobile browser, why not try open the share function in native FB app using custom url scheme (Centainly works in iOS and should work in Android since android too supports this scheme using Intents). That way user would not have to login again in browser version of Facebook.

Try - fb://post/. More url options here

Community
  • 1
  • 1
Vikram Rao
  • 514
  • 3
  • 16
  • does the sharer.php (query parameters) options apply to these ? For instance, to=recipient_id, mode=message (private message) etc. – younes0 Mar 03 '14 at 15:23