IgorCh
IgorCh

Reputation: 2661

Facebook share ignores custom query string parameters

I try to share an URL that contains query parameter in FB.

Here is my share link

Sharing works but my custom query parameter is gone and replaced with facebook query parameters in the facebook timeline something like here

The same problem when FB.ui({ method: 'share',... is used.

It worked well on previous version of facebook sharing sharer.php but it's deprecated now and I have no idea how to make current share work.

Upvotes: 2

Views: 3141

Answers (2)

Florian
Florian

Reputation: 175

i assume you solved your problem in a different way already but i have found a solution for this. Just in case somebody else comes across this question.

Facebook strips the parameters only when it is more or less sure that the file is an php file.

So for http://example.com/?test=1 or http://example.com/index.php?test=1 the parameters are removed.

But if you make it look like a normal html file, it works: http://example.com/whatever.htm?test=1 for example is posted with the parameters.

Of course you can use some simple mod_rewrite Rule to redirect the request to the original php file:

RewriteRule /whatever.htm(\?.*) /index.php%1

(rule is untested but should work hopefully)

Upvotes: 0

Kapil
Kapil

Reputation: 41

We faced same problem. We instead used Feed Dialog that works fine. The irony is that if you read on facebook's developer's site Facebook is recommending us using Share Dialog in place of Feed dialog however, Share dialog does not work as expected.

Here is the link to get more information on Feed dialog

https://developers.facebook.com/docs/sharing/reference/feed-dialog/v2.2

Personally i like Feed dialog more the share cause it gives you some additional properties to manage how dialog should appear

Upvotes: 4

Related Questions