开发者

How to detect if my site is in Facebook iframe or standalone site

开发者 https://www.devze.com 2023-01-18 10:41 出处:网络
I want to programatically detect if my site is within the Facebook iFrame app so I can display certain f开发者_运维技巧eatures specifically for Facebook. Otherwise if someone goes site without Faceboo

I want to programatically detect if my site is within the Facebook iFrame app so I can display certain f开发者_运维技巧eatures specifically for Facebook. Otherwise if someone goes site without Facebook. Preferably an FBML, C# or JS solution would be great :) Thx!


Well, you can always go with the basic javascript check for whether or not a page is framed

if ( top === window )
{
  // page is not framed
}

Also, when a user first hits your canvas page, the Facebook platform sends a bunch of data to your callback url, either in normal GET parameters or in a single, encoded parameter (depending on your settings) which you can also check for.

0

精彩评论

暂无评论...
验证码 换一张
取 消