Wes Gamble
Wes Gamble

Reputation: 787

Share dialog posts do not include query string of deep link to facebook iframe page tab

I am attempting to use the standard Facebook share button to share a deep link into my iframe page tab of the form:

https://www.facebook.com/YourPage?v=app_1234567890&app_data=any_string_here

where app_data content is a deep link relative path into my iframe page tab app content (e.g. /path/to/page_that_I_shared_from).

Just to be clear, there is a Share button on my iframe app page, and I am trying to generate the link back to that page to be shared.

I place the absolute URL above into the data-href parameter per the Share Dialog documentation, and when I click the Share button, the url in the share dialog is of the form:

https://www.facebook.com/sharer/sharer.php?app_id=my_app_id&sdk=joey&u=url_encoded_version_of_the_absolute_url_above&display=popup

but when the post is rendered, the query string is stripped completely.

Note that if I use a non-Facebook URL, the query string is preserved.

I do notice that app_id parameter in the share dialog URL - perhaps the fact that this is coming from inside the page tab iframe makes a difference.

Initial testing with the feed dialog looks promising, but I'd like to use the share button since it provides more flexibility as to the destination of the post.

Upvotes: 0

Views: 1022

Answers (1)

Wes Gamble
Wes Gamble

Reputation: 787

The final solution was to generate the link like so:

https://www.facebook.com/pages/<page id>/<page id>?id=<page_id>&amp;sk=app_<FB_app_ id>&amp;app_data=<deep link>

where deep_link is a relative URL with a query string that starts with a '?' and has the '&' characters replaced with '|' characters (poor man's encoding that I decode on the way in).

I saw several suggestions (mostly here on SO) to double or even triple encode the app_data URL - none of these worked, and usually they resulted in links that could not be posted by the sharer.php script.

Upvotes: 1

Related Questions