[Facebook] Page Tab App (iframe) Redirect Problem and Solution

Tadashi Shigeoka ·  Fri, June 1, 2012

I got stuck on an issue where executing redirect processing in a Facebook page tab app (iframe) would result in a blank white screen with nothing displayed.

■ Server request/response log

HTTP/1.1 302 Moved Temporarily P3P: CP="IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT" Location: https://www.facebook.com/pages/My-Page/xxxxxxxxxxxx?sk=app_xxxxxxxxxx Content-Type: text/html; charset=utf-8 X-UA-Compatible: IE=Edge Cache-Control: no-cache X-Request-Id: 8700a35ce62854a9d99abc225bbb9903 X-Runtime: 0.002538 Connection: close Server: thin 1.3.1 codename Triple Espresso
You are being redirected.

The cause was that the redirect was being performed from within the iframe.

You can fix this by specifying target=“_top” in the a tag to break out of the frame.

■ Example that doesn’t work (error)

Facebook Auth

■ Working solution (adding target=“_top”)

Facebook Auth

That’s all from the Gemba.