Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I detect either users open my Facebook app in iframe or direct url

Lets say my Facebook app url is http://fb.domain.com/ and the app url is http://apps.facebook.com/demoapp/

Now I want a user cannot open the application url directly and must in iframe on Facebook.

How do I detect & redirect link to http://apps.facebook.com/demoapp/ if user open the link directly?

Let me know the key.

like image 865
wow Avatar asked Dec 01 '22 03:12

wow


1 Answers

If you are just trying to detect whether a user has opened your URL inside of an iframe, with javascript enabled you could do:

if (window!=window.top) { /* I'm in a frame! */ }

Hope that answers your question.

like image 171
Philoxopher Avatar answered Dec 05 '22 01:12

Philoxopher