强制Facebook应用使用页面标签iframe [英] Force facebook app to use page tab iframe

查看:128
本文介绍了强制Facebook应用使用页面标签iframe的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个iframe Facebook应用程序当前正在页面选项卡上运行.不幸的是,当人们共享页面内的某些链接时,生成的共享链接会将用户发送到服务器上的原始内容,而不是Facebook页面选项卡.如何强制直接到达该网址的用户进入页面标签iframe?

I have an iframe facebook app currently running on a page tab. Unfortunately, when people share some of the links within the page, the resulting shared links send users to the original content on the server and not to the facebook page tab. How can I force users who arrive directly at the URL into the page tab iframe?

推荐答案

我找到了解决方案:基本上,您可以使用facebook javascript api来检测您是否在iframe中.如果没有,请重定向.这是代码:

I found the solution: basically you can use the facebook javascript api to detect if you are within the iframe. If not, redirect. Here is the code:

        // Test if canvas page loaded
            var obj = FB.Canvas.getPageInfo();
        // Now redirect to page if not
            if(obj.clientHeight == 0) window.location = 'http://facebook/page/url/';

这篇关于强制Facebook应用使用页面标签iframe的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆