facebook - is it possible to share whole Fb app Canvas page through app? -


i'm working on photo contest fb app run in fan page tab. user should able share photo in order others vote them. supposing image link in iframe http://example.com/image.php?id=1 particular photo, pressing share share link through iframe. leads host app itself. need sharing whole fb app tab page url http://example.com/image.php?id=1 open in iframe. possible in way? help.

so give “alternative” @lix’ answer, focuses on canvas apps, here analog way page tab apps:

for reason facebook decided things differently page tab apps – different canvas apps, can not pass parameters app appending them facebook.com address of app, have use app_data parameter that.

you call/link app in form https://www.facebook.com/yourpage?v=app_1234567890&app_data=foo – , whatever put value parameter app_data, find in signed_request parameter facebook posts app on initial(!) load iframe.

so parse signed_request (or let f.e. php sdk you), , find app_data value in there. if want pass more 1 single value, can f.e. put json-encoded data there – have decode again after read app_data value signed request.

the docs just shortly mention app_data parameter, principle quite simple.


now, when comes sharing links, found when use address in above form, facebook tends cut parameters url, , treat whole link link facebook page – shows page’s picture , description, , not pass page tab app along, let alone app_data parameter.

i found reliable way around not link page tab on facebook directly, instead url of own app. when scraper visits it, deliver relevant og information. , when it’s real user visiting, redirect them page tab app, passing data need via app_data parameter described above. redirecting can either done server-side (info on how detect scraper server-side via user-agent header), or client-side via javascript (which scraper not “speak”).


Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -