Categories
Code Snippets English

Facebook: Pop-in.

What do you do when you have a Facebook app tab (inside an iframe, mind you) that’s externally linkable? Pop-in.

Screen Shot 2013-08-07 at 9.43.48 AM

Let’s break this down.

if (self === top) {

This conditional will be true when the browser is not inside an iframe.

window.location.href = 'https://www.facebook.com/test/app_1234';

If we are not inside an iframe, then redirect to the following URL.