简体   繁体   中英

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.

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

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.

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.

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.

See this link for documentation: http://developers.facebook.com/docs/reference/api/user/#likes

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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