简体   繁体   English

Facebook canvas应用-揭示页面问题

[英]facebook canvas app - reveal page issue

Its a reveal page app and 它是一个揭示页面的应用程序,

The app check if the user likes the fanpage through signed_request, if not it shows an image that says like us, else it shows the content to the fan. 该应用程序通过signed_request检查用户是否喜欢该粉丝页面,如果不喜欢,则显示一个像我们这样的图像,否则它向粉丝显示内容。

This works fine when someone comes to the fanpage ie app is running within the fanpage as a tab. 当有人进入粉丝页面时,即应用程序在粉丝页面中作为选项卡运行时,这可以很好地工作。 eg http://www.facebook.com/myfanpage?sk=app_xxxxxxxxxxxxxx 例如http://www.facebook.com/myfanpage?sk=app_xxxxxxxxxxxxxx

If someone comes to the app directly eg http://apps.facebook.com/myappname it always shows the image that says like us whether user already likes or not. 如果有人直接访问该应用程序,例如http://apps.facebook.com/myappname,则它总是显示与用户一样喜欢我们的图像。

Is there a way to check how the app is being accessed? 有没有办法检查应用程序的访问方式? directly or as a tab in the fan page? 直接还是作为粉丝页面中的标签? I can not use 'top.location.href' in javascript, it returns null I guess because of obvious reasons of cross domains, ie app is running from some other domain and not on facebook. 我无法在javascript中使用“ top.location.href”,由于跨域的明显原因,我猜它返回null,即应用程序是从其他某个域运行的,而不是在facebook上运行。

Regards 问候

You can use the Facebook JavaScript SDK to call the Graph API URL in the form https://graph.facebook.com/PROFILE_ID/likes/PAGE_ID and see if the user likes your page. 您可以使用Facebook JavaScript SDK以https://graph.facebook.com/PROFILE_ID/likes/PAGE_ID的形式调用Graph API URL,并查看用户是否喜欢您的页面。

See this link for documentation: http://developers.facebook.com/docs/reference/api/user/#likes 请参阅此链接以获取文档: http : //developers.facebook.com/docs/reference/api/user/#likes

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM