Blank Facebook Canvas With Rails
Facebook Page Tab App Is Blank?
Facebook page and canvas apps with Rails 4, can lead to a blank white page. In Rails 4, the X-Frame-Options are sets by default, and you should override them, to allow iframes in Rails.
class FacebookClubsController < ApplicationController
layout "facebook_canvas"
after_filter :allow_iframe
def index
end
private
def allow_iframe
response.headers["X-Frame-Options"] = "GOFORIT"
end
end
Written by Shavit
Related protips
4 Responses
Oh my god, I wanna kiss you now :D I've been banging my head all day with this and I had no clue where to look at. THANK YOU!!!
over 1 year ago
·
@mrfoto I'm glad to hear it works for you
over 1 year ago
·
Great tip! I've been having problems with this for a couple of hours and couldn't figure out what was going on. Thank you!
over 1 year ago
·
Why set an invalid value for it when you can just remove it altogether?
def allow_iframe
response.headers.except! 'X-Frame-Options'
end
over 1 year ago
·
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Rails
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#