Reputation: 11701
How can we find using PHP or Javascript if the facebook app is running within Facebook or running outside of Facebook as a Website. Am not sure what should be the criterion to check?
Upvotes: 0
Views: 149
Reputation: 43
Check for signed_request is not enough. In case of more pages, navigation is in frame and you lose the signed_request parameter.
First check for signed_request in first page, then put in session a bool variable and do controls on this.
This approach has a problem: if you open another tab and visit app in Facebook (or viceversa), you will share the session :)
Upvotes: 1
Reputation: 11701
Did some checking. The answer below works:
if(isset($_REQUEST["signed_request"]){
// Opened in facebook
}else{
//opened outside facebook.
}
Upvotes: 3