Reputation: 3103
I want to develop a Facebook connect application that can operate both inside a Facebook canvas or standalone.
Can I check if the user is using Facebook canvas / not using the official Facebook PHP client library?
Thanks, Andree
Upvotes: 5
Views: 2342
Reputation: 11266
Check the HTTP_REFERER
header. If the referrer is "apps.facebook.com", then its loading in Facebook canvas.
Upvotes: 0
Reputation: 54
In case of a Canvas page, Facebook will pass the client's IP address in an additional HTTP header called X-FB-USER-REMOTE-ADDR
.
http://wiki.developers.facebook.com/index.php/Your_callback_page_and_you
If it's set, you're on Facebook.
A hacker could also send this header, and that could result in unexpected behaviour from your app when outside Facebook.
Upvotes: 3