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 i.e. app is running within the fanpage as a tab. e.g. http://www.facebook.com/myfanpage?sk=app_xxxxxxxxxxxxxx
If someone comes to the app directly e.g. 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, i.e. app is running from some other domain and not on facebook.
Regards
if($signed_request = parsePageSignedRequest()) { if($signed_request->page->liked) {
– practitioner Feb 21 '12 at 04:57