Force facebook app to use page tab iframe

笑着哭i 提交于 2019-12-13 03:31:14

问题


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?


回答1:


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/';


来源:https://stackoverflow.com/questions/6076359/force-facebook-app-to-use-page-tab-iframe

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!