facebook - 是否可以将参数传递给通过选项卡访问的 FB 应用程序的回调 URL?

标签 facebook

我有这个 facebook 应用程序,它向粉丝页面添加了一个自定义选项卡。您可以通过如下 URL 访问该选项卡:

http://www.facebook.com/pages/PAGE-NAME-HERE/PAGE-ID?v=APP-ID

我希望能够向该 URL 添加一些额外的获取参数,但似乎它们没有正确传递,因为 facebook 正在过滤它们。有没有办法传递这些参数?即使不是通过 GET,而是通过其他一些技术。

最佳答案

如果您想通过 app_data 参数传递多个查询字符串参数,您可以对其进行 urlencode

所有需要通过 Facebook 选项卡传播的查询字符串参数都应该在 app_data var 中进行 url 编码。

换句话说,“&”和“=”需要进行 url 编码(尤其是在传递多个参数时)。

例子

GOOD TAB URL(传递所有 3 个参数):

https://www.facebook.com/pages/yourpagename/56789?sk=app_12345&app_data=var1%3D123456789%26anothervar%3Drawr%26athird%3Dmeow

在这个签名请求的 app_data 中,我得到了这个值:var1=123456789&anothervar=rawr&athird=meow

BAD TAB URL(这仅通过 signed_request 传递第一个参数):

https://www.facebook.com/pages/yourpagename/12345?sk=app_56789&app_data=var1=123456789&anothervar=rawr&athird=meow

在这个签名请求的 app_data 中,我只得到了这个值:var1=123456789(Facebook 放弃了其余的)

您甚至可以像这样给您的媒体团队指示 =)

Media team,

Here is an online utility to urlencode the querysting data you want to embed in the app_data param: http://meyerweb.com/eric/tools/dencoder/

Base Url: https://www.facebook.com/pages/yourpagename/12345?sk=app_56789&app_data=

Steps:

  1. Go to http://meyerweb.com/eric/tools/dencoder/
  2. Type var1=123456789&anothervar=rawr&athird=meow in the box
  3. Hit the Encode button
  4. You’ll get var1%3D123456789%26anothervar%3Drawr%26athird%3Dmeow which becomes your app_data param. Append that to the baseUrl noted above like this: https://www.facebook.com/pages/yourpagename/12345?sk=app_56789&app_data=var1%3D123456789%26anothervar%3Drawr%26athird%3Dmeow (this is the URL with the tracking params for the [banner ad] [online media] [etc])

附注非标签页中的查询字符串参数处理得很好(例如,https://apps.facebook.com/yourappname/Canvas.aspx?var1=123456789&anothervar=rawr&athird=meow 不会像在标签页中那样删除 qs 参数)。

关于facebook - 是否可以将参数传递给通过选项卡访问的 FB 应用程序的回调 URL?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4634102/

相关文章:

Facebook 应用程序 : retrieve list of ids of my application's users

javascript - 如何使用 facebook api 邀请用户加入 facebook 群组

javascript - 如何检测 Facebook/Instagram/Twitter 浏览器?

facebook - Flutter:显示也使用该应用程序的 Facebook 好友

php - Facebook 图搜索 API

objective-c - UIWebview 和 facebook 墙

java - 无法在签名的 apk 中登录 Facebook?

ios - 无效的 iOS bundle

java - 面对 java.lang.UnsupportedClassVersionError : com/facebook/fb303/FacebookService$Iface error while starting hive

android - Facebook Android SDK & java.lang.NullPointerException