Getting nested iframes with Facebooker in iframe app

余生颓废 提交于 2019-12-06 14:18:05

问题


Has anyone encountered nested iframes in their Rails/Facebooker application? Basically, every time I click an action or link, the entire facebook page reloads inside my existing iframe, causing two (and more on each subsequent click) facebook borders to appear.

I've gone over the instructions three times and changed every setting imaginable, but the app still opens up in new facebook page inside the iframe. Any ideas anyone?

itonly appears when I use the

ensure_application_is_installed_by_facebook_user

filter, but if the user already has the application installed and I use the

ensure_authenticated_to_facebook

filter, it works fine...very strange (to me at least)


回答1:


Turns out ensure_application_is_installed_by_facebook_user is deprecated because of a change in Facebook's API. I plan to update the Facebooker documentation with this information soon.




回答2:


I experienced the same thing with nested iframes, so I used "ensure_authenticated_to_facebook" instead. The only gotcha was that after the user installed the app, it would redirect them to my domain and not the facebook iframe page. After doing some tweaking in facebooker, I decided to hard code :canvas=>"true" in this method which is in lib/facebooker/rails/controller.rb line 189

def create_new_facebook_session_and_redirect!
      session[:facebook_session] = new_facebook_session
      next_url = after_facebook_login_url || default_after_facebook_login_url
      #top_redirect_to session[:facebook_session].login_url({:next => next_url, :canvas=>params[:fb_sig_in_canvas]}) unless @installation_required
      top_redirect_to session[:facebook_session].login_url({:next => next_url, :canvas=>"true"}) unless @installation_required
      false
end

I wrote a tutorial on this fix in my blog - http://railsrant.com/2009/10/14/creating-a-facebook-iframe-app-using-ruby-on-rails-facebooker/



来源:https://stackoverflow.com/questions/1474817/getting-nested-iframes-with-facebooker-in-iframe-app

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