相当于 FB.Facebook.get_isInCanvas 的新 SDK 是什么
试图找到新的 Facebook javascript sdk 相当于:
FB.Facebook.get_isInCanvas
是否也有这种调用的 PHP SDK 方式?
我需要测试是否在画布内,标头检查和signed_request 检查无法确定用户是否在应用程序内的 Facebook 上...除非我没有正确的检查方法...
Trying to find the new Facebook javascript sdk equivalent to:
FB.Facebook.get_isInCanvas
Is there a PHP SDK way of this call as well?
I need to test if inside the canvas, and header checks and signed_request checks do not determine if user is on Facebook within the Application...unless I don't have the right way of checking...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
FB._inCanvas
是您想要从 Facebook JS SDK 获得的内容,但我发现有时并不总是设置,所以让我们看看他们自己如何进行检查并复制:请参阅 https://github.com/facebook/facebook-js-sdk/blob/master/src/core/prelude.js#L71
更新
其新版本是:
FB._inCanvas
is what you want from the Facebook JS SDK however that i found is sometimes not always set so lets see how they themselves do the check and copy that:See https://github.com/facebook/facebook-js-sdk/blob/master/src/core/prelude.js#L71
UPDATE
The newer version of this is:
使用 PHP-SDK,如果您的
$_REQUEST
/$_POST
中有signed_request
,则可以假定应用程序在画布中运行。不完全安全,但在大多数情况下可以假设它......JS-SDK 可以通过检查
window.top == window
来确定它没有在画布中运行,如果你需要知道你是在画布中,而不仅仅是某人的框架中。更新:
刚刚检查过,JS-SDK 中有一个更好的选项来检查您是否在画布中运行,但我不确定这种行为将来不会改变。你可以使用这样的东西:
Using PHP-SDK you can assume application running in canvas if you have
signed_request
in your$_REQUEST
/$_POST
. Not fully safe but may be ok to assume it in most cases...JS-SDK can say that it's not running in canvas for sure only by checking
window.top == window
not very useful if you need to know you're in canvas and not just someone's frame.Update:
Just checked and there is a better option in JS-SDK to check if you running in canvas but I'm not sure this behavior wouldn't change in future. You can use something like this: