开发者

Bookmark facebook app with parameter

开发者 https://www.devze.com 2023-03-21 02:01 出处:网络
I\'d like my app users to be able to bookmark my app with some additional parameter (for instance: http://apps.facebook.com/my-app/?ref=bookmarks&additional=aaaa) depending开发者_StackOverflow中文

I'd like my app users to be able to bookmark my app with some additional parameter (for instance: http://apps.facebook.com/my-app/?ref=bookmarks&additional=aaaa) depending开发者_StackOverflow中文版 on which I will present my users different output. Is it possible?


Yes, it is. You have to use the app_data parameter. Have a lookt at these links:

  • Facebook documentation Signed Request
  • Facebook iFrame Tab Applications

So, basically, the app_data parameter will be passed through in the signed_request to your app within the iFrame. For this to work you have to json_encode the parameter. So, in your example case:

http://apps.facebook.com/my-app/?app_data={'ref': 'bookmarks', 'additional': 'aaaa'}

and finally url encoded:

http://apps.facebook.com/my-app/?app_data=7B%27ref%27%3A+%27bookmarks%27%2C+%27additional%27%3A+%27aaaa%27%7D

to gain access, you have to read out the signed_request:

$app_data = json_decode($signed_request["app_data"]);
$additional = $app_data['additional'];


fb:bookmark is part of the deprecated FBML, so long term you need to look for a different solution anyway

0

精彩评论

暂无评论...
验证码 换一张
取 消