在接受我们的应用程序发送的应用程序请求后,如何重定向到我的应用程序页面?

发布于 2024-12-08 00:35:32 字数 199 浏览 4 评论 0原文

我有 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

那支青花 2024-12-15 00:35:32

您可以在数据参数中放置一个网址,

请参阅此处 http://developers.facebook.com /docs/reference/dialogs/requests/ 在底部的属性下。

数据 可选的,您可以传递用于跟踪的附加数据。这将
存储为创建的请求对象的一部分。

这将传回给您,您可以使用 javascript 将 location.href 指向数据中的 url。

----------这是我过去使用过的示例

    var thisimg = 'AN_IMG';
    var thisurl = 'A_URL';  
    window.sendrequest = function(){
             FB.ui({ method: 'apprequests', 
             title: 'A request.',
        message: 'Rate Me! Request from: ' +thisname+' ',
        data: ''+thisimg+' '+thisurl+' ',
        filters: ['all'],
        });
        }

---------- 来自 Facebook 的示例,添加了数据参数。

        var thisimg = 'AN_IMG';
        var thisurl = 'A_URL';
  function sendRequestToManyRecipients() {
    FB.ui({method: 'apprequests',
      message: 'My Great Request',
      data: ''+thisimg+' '+thisurl+' ',
    }, requestCallback);
  }

  function requestCallback(response) {
    // Handle callback here
  }

回调后,您可以执行 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.

data Optional, additional data you may pass for tracking. This will
be stored as part of the request objects created.

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

    var thisimg = 'AN_IMG';
    var thisurl = 'A_URL';  
    window.sendrequest = function(){
             FB.ui({ method: 'apprequests', 
             title: 'A request.',
        message: 'Rate Me! Request from: ' +thisname+' ',
        data: ''+thisimg+' '+thisurl+' ',
        filters: ['all'],
        });
        }

---------- Sample from Facebook with data param added.

        var thisimg = 'AN_IMG';
        var thisurl = 'A_URL';
  function sendRequestToManyRecipients() {
    FB.ui({method: 'apprequests',
      message: 'My Great Request',
      data: ''+thisimg+' '+thisurl+' ',
    }, requestCallback);
  }

  function requestCallback(response) {
    // Handle callback here
  }

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."

梦毁影碎の 2024-12-15 00:35:32

由于您已经在您的应用程序中包含了 Facebook javascript SDK,并且您已经在脚本

FB.ui({ method: 'apprequests', redirect_uri: 'APP URL',
消息:'我的消息'});

这将重定向到应用程序 URL,而不重定向到 Facebook 画布 URL。因此,即使您使用

FB.ui({ method: 'apprequests', data: 'APP URL',
消息:'我的消息'});

将此代码写入您的应用程序登陆页面,即index.php

$requestid=$_GET[request_ids];
if(!empty($requestid)) {
    echo "<script> window.top.location.href='APP URL'; </script>";
}

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

$requestid=$_GET[request_ids];
if(!empty($requestid)) {
    echo "<script> window.top.location.href='APP URL'; </script>";
}
丶视觉 2024-12-15 00:35:32

这是一个老问题,但现在有一个更简单的解决方案。

在 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文