是否可以将参数传递给通过选项卡访问的FB应用程序的回调URL? [英] Is it possible to pass parameters to the callback URL of a FB app which is accessed through a tab?

查看:55
本文介绍了是否可以将参数传递给通过选项卡访问的FB应用程序的回调URL?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这个facebook应用程序,它向粉丝页面添加了一个自定义标签.您可以通过以下网址访问该标签:

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

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

解决方案

如果要通过app_data参数传递多个查询字符串参数,则可以对其进行编码.

所有需要通过Facebook标签传播的查询字符串参数都应在app_data变量中进行url编码.

换句话说,&"和"="需要进行网址编码(特别是如果传递多个参数的话).

示例

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

>: //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):

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

在此已签名请求的app_data中,我仅获得以下值: var1 = 123456789 (Facebook删除了其余部分)

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

媒体团队,

这是一个在线实用程序,用于对您要查询的查询数据进行urlencode 嵌入到app_data参数中: http://meyerweb.com/eric/tools/dencoder/

基本网址: https://www.facebook.com/pages/yourpagename/12345?sk = app_56789& app_data =

步骤:

  1. 转到 http://meyerweb.com/eric/tools/dencoder/
  2. 在框中输入var1 = 123456789& anothervar = rawr& athird = meow
  3. 点击编码"按钮
  4. 您将获得var1%3D123456789%26anothervar%3Drawr%26athird%3Dmeow,它将成为您的app_data参数.像这样将其追加到上面指出的baseUrl中: https://www .facebook.com/pages/yourpagename/12345?sk = app_56789& app_data = var1%3D123456789%26anothervar%3Drawr%26athird%3Dmeow (这是[横幅广告] [在线媒体的跟踪参数的网址] [etc])

p.s.非标签页中的查询字符串参数可以很好地处理( https://apps.facebook.com/yourappname/Canvas.aspx?var1=123456789&anothervar=rawr&athird=meow 不会去除qs参数,例如Tab中出现的情况.

I have this facebook application which adds a custom tab to fan pages. You access the tab by an URL like:

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

I want to be able to add some extra get parameters to that URL, but it seems they don't get passed correctly because facebook is filtering them. Is there a way to pass those parameters? Even not via GET but some other kind of technique.

解决方案

If you want to pass multiple querystring params though the app_data param, you can urlencode it.

All querystring params that need to propagate through a Facebook tab should be url-encoded in the app_data var.

In other words, the "&" and the "=" need to be url-encoded (especially if passing more than one param).

Examples

GOOD TAB URL (this passes all 3 params):

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

In the app_data from this signed request, I got this value: var1=123456789&anothervar=rawr&athird=meow

BAD TAB URL (this passes only the first param through the signed_request):

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

In the app_data from this signed request, I ONLY got this value: var1=123456789 (Facebook dropped the rest)

You can even give your media team instructions like this =)

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])

p.s. Querystring params in non-tab pages are handled fine (https://apps.facebook.com/yourappname/Canvas.aspx?var1=123456789&anothervar=rawr&athird=meow does not strip out qs params like what happens in the Tab, for example).

这篇关于是否可以将参数传递给通过选项卡访问的FB应用程序的回调URL?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆