如何了解您的页面是在 facebook 下被请求还是不在 masterpage asp.net 内被请求
我将把我的网站作为应用程序添加到 Facebook。 Facebook 不允许第三方广告,所以我必须删除它们。我想删除仅针对 Facebook 访问者的广告。所以我想了解页面是否在 facebook 下作为 iframe 被调用。我怎样才能用javascript做到这一点?谢谢。
我也可以使用jquery。
ASP.NET 4.0
I am going to add my website to the facebook as an application. Facebook do not allow 3 rd party ads so i have to remove them. I want to remove ads for only facebook visitors. So i want to understand whether page is being called under facebook as an iframe or not. How can i do that with javascript ? Thank you.
I can also use jquery.
asp.net 4.0
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
以下代码检测您的页面是否在 iframe 中查看:
[编辑]
如果您还想指定 iframe 位于 facebook 中,那么您可以尝试以下操作:
我还没有测试过这个,只是几周前遇到的 此处
The following detects if your page is viewed in an iframe:
[EDIT]
If you want also to specify that the iframe is in facebook then you could try this:
I haven't tested this, just came across a few weeks ago here