Can't use facebook sharer.php custom parameters in mobile sites
Asked Answered
V

4

17

I own a jQuery mobile website. There i using facebook share option with custom parameters to add title, description, image with link

Like below, https://www.facebook.com/sharer/sharer.php?s=100&p%5Burl%5D=http%3A%2F%2Fgoogle%2F&p%5Bimages%5D%5B0%5D=https://www.google.com/images/srpr/logo3w.png&p%5Btitle%5D=My%20own%20title&p%5Bsummary%5D=My%20own%20description

But when i try the same link to mobile, it will redirect to http://m.facebook.com/sharer.php?s=100&p%5Burl%5D=http%3A%2F%2Fgoogle%2F&p%5Bimages%5D%5B0%5D=https%3A%2F%2Fwww.google.com%2Fimages%2Fsrpr%2Flogo3w.png&p%5Btitle%5D=My+own+title&p%5Bsummary%5D=My+own+description&_rdr

which means, it will add m.facebook at the start of share url. so it wont work with custom title, desc, image & link.

Anyway to fix this? or how to force mobile web to not to go with m.facebook.com ?

Valine answered 17/1, 2013 at 11:21 Comment(0)
S
38

You can prevent Facebook from going to the mobile site by adding a ?m2w parameter to the URL. Then, sharer.php works like usual.

e.g.

 https://www.facebook.com/sharer/sharer.php?m2w&s=100.... (etc)

Looks kind of bad though, looking for a better answer.

Edit: Sharer.php has been deprecated, see Felix' answer below.

Springhalt answered 8/2, 2013 at 16:29 Comment(2)
Thanks thanks thanks ! Do you know where can we find a complete list of the facebook/sharer params ?Thermochemistry
sharer.php has now been deprecated, see answer below.Norenenorfleet
N
8

sharer.php has now been deprecated. https://developers.facebook.com/bugs/252983554810810/

The new method is to use the share dialog: https://developers.facebook.com/docs/sharing/reference/share-dialog

e.g.

https://www.facebook.com/dialog/share?
  app_id=145634995501895
  &display=popup
  &href=https%3A%2F%2Fdevelopers.facebook.com%2Fdocs%2F
  &redirect_uri=https://developers.facebook.com/tools/explorer
Norenenorfleet answered 27/3, 2014 at 23:36 Comment(1)
can we add the caption,image,descript to above url parameter?Coliseum
T
7

url for mobile is supported as u, and title is supported as t

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

source

Togliatti answered 24/9, 2013 at 16:43 Comment(1)
While not given, it works to add u and t to the normal sharer-url, they'll remain in the url when Facebook redirects to the mobile site.Infest
I
1

Use the mobile url to fix the problem in mobile devices, Facebook will redirect to the share dialog in desktop.

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

Here is an example: https://careers-hangarcr.herokuapp.com/job/apply/55c277c0fb8b040300622602

Increate answered 27/1, 2016 at 1:14 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.