Aron
Aron

Reputation: 3571

Force facebook app to use page tab 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?

Upvotes: 0

Views: 1747

Answers (1)

Aron
Aron

Reputation: 3571

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

Upvotes: 1

Related Questions