How to know if my page is running in a facebook iframe or not

后端 未结 6 2027
被撕碎了的回忆
被撕碎了的回忆 2020-12-30 09:51

I\'m currently developing a site which runs standalone and as a facebook app on an iframe I was wondering what whold be \"best practice\" for checking if my page is ran in a

6条回答
  •  执念已碎
    2020-12-30 10:43

    Here is some php code to test if the current page is running inside a facebook iframe :

    if( strpos( $_SERVER[ 'HTTP_REFERER' ], "apps.facebook.com" ) !== false ){
        // Page is running in Facebook iframe
    }
    

提交回复
热议问题