在接受我们的应用程序发送的应用程序请求后,如何重定向到我的应用程序页面?
我有 facebook apprequests (oauth2, graph) 的问题,
我向我的朋友 B 发送了一个应用程序请求。 B登录facebook,在应用程序列表中找到了我们的请求。 B 单击接受按钮
B 重定向到 facebook 画布页面。我想重定向到我们的应用程序,而不是 Facebook 的画布,这可行吗?
谢谢
I have a issue for facebook apprequests (oauth2, graph)
I sent a app request to my friend B.
B logged into facebook and found our request in the app list.
B clicked the accept button
B redirected to the facebook canvas page. I want to rediect to our app, not facebook's canvas, is this doable?
thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您可以在数据参数中放置一个网址,
请参阅此处 http://developers.facebook.com /docs/reference/dialogs/requests/ 在底部的属性下。
这将传回给您,您可以使用 javascript 将 location.href 指向数据中的 url。
----------这是我过去使用过的示例
---------- 来自 Facebook 的示例,添加了数据参数。
回调后,您可以执行 window.top.location.href='';与您传入数据的网址。
注意:请求的默认重定向是画布,无法更改。用户登陆您的画布后,您将从请求中读取数据参数并将其重定向到您的外部应用程序。
“我没有看到任何其他方法可以做到这一点,因为 requests2.0 不包含重定向 uri 的选项。”
you can put a url in the data param
see here http://developers.facebook.com/docs/reference/dialogs/requests/ under properties at bottom.
This will get passed back to you and you can use javascript to location.href to the url in the data.
----------Here is a sample i have used in the past
---------- Sample from Facebook with data param added.
upon callback you can do a window.top.location.href=''; with the url you passed in data.
NOTE: The default redirect for a request is the canvas, this cannot be changed. After user lands on your canvas you will read the data param from the request and redirect them to your external app.
"i do not see any other way to do this, since requests2.0 does not include option for a redirect uri."
由于您已经在您的应用程序中包含了 Facebook javascript SDK,并且您已经在脚本
FB.ui({ method: 'apprequests', redirect_uri: 'APP URL',
消息:'我的消息'});
这将重定向到应用程序 URL,而不重定向到 Facebook 画布 URL。因此,即使您使用
FB.ui({ method: 'apprequests', data: 'APP URL',
消息:'我的消息'});
将此代码写入您的应用程序登陆页面,即index.php
As you have already included Facebook javascript SDK in your App and you have writen this code for inviting friend for your App in a script
FB.ui({ method: 'apprequests', redirect_uri: 'APP URL',
message: 'My Message' });
This will redirect to App URL without redirecting to Facebook canvas URL.So this will not work even if you use data parameter such as
FB.ui({ method: 'apprequests', data: 'APP URL',
message: 'My Message' });
Write this code at your App landing page i.e. in index.php
这是一个老问题,但现在有一个更简单的解决方案。
在 Facebook 应用程序设置中的“Facebook Canvas”下,有一个标题为“移动站点 URL”的字段。当用户尝试从移动设备打开您的画布应用程序时,他将被重定向到该 URL。
该 URL 应指向一个页面,您应根据浏览器用户代理从该页面重定向到 App Store 或 Play Store(或即将推出的页面)。
This is an old question, but now there is a simpler solution.
In the Facebook app settings under "Facebook Canvas" there is a field titled "Mobile Site URL". When a user tries to open your canvas app from a mobile device (s)he will be redirected to that URL.
That URL should point to a page from which you should redirect to the App Store or Play Store (or coming soon page) based on the browser user agent.