dsdsdsdsd
dsdsdsdsd

Reputation: 2962

best way to determine if my_page is being loaded only by facebook

Is there a sure-fire way to determine if my_page is being loaded into an iframe of only facebook?


some techniques that partially help:

A (php) - the php $_REQUEST seems to have some implicit possibilities, but seems questionable since I believe it could be mimicked by other sites.

B (js) - I can use js to do (self == parent) to determine if my_page is being loaded into a parent frame ... but I cannot get anymore info than that. For instance, the url of the parent.

C (fb-jsSDK) - The facebook javascript SDK gives me some info as to whether my_page is being loaded by a logged in user, but seems to be uninformative if loaded by a non-logged in user.


IGY (and others): please do not trash my post ... if you know of a better place on the internet to ask this question, then tell me. Facebook advised developers to come here to ask questions.

Upvotes: 0

Views: 298

Answers (1)

C3roe
C3roe

Reputation: 96363

I’d say the best way is to look for the signed_request parameter – when it is there and you have successfully verified it, then you can be sure that it is the intial load of your app into either a canvas or page tab iframe directly on Facebook.

(Verifying the signed_request requires your app secret, and only you and Facebook know that.)

Since you only get a signed_request on the initial load of your page, you should then put that info – page has been called in an iframe on facebook.com - into your session, so that you can look it up there on subsequent pages.

Upvotes: 1

Related Questions