I get an unlimited amount of this message (e.g. in a loop) and it crashes the website
Rails 4.0.0 (with Turbolinks)
Error message
Blocked frame with source " https://www.facebook.com " from access frame with source " http://app.herokuapp.com ". Request frame access has the protocol "https", access to the frame has the protocol "http". Protocols must comply.
Facebook.js.coffee
fb_root = null fb_events_bound = false $ -> loadFacebookSDK() bindFacebookEvents() unless fb_events_bound bindFacebookEvents = -> $(document) .on('page:fetch', saveFacebookRoot) .on('page:change', restoreFacebookRoot) .on('page:load', -> FB?.XFBML.parse() ) fb_events_bound = true saveFacebookRoot = -> fb_root = $('#fb-root').detach() restoreFacebookRoot = -> if $('#fb-root').length > 0 $('#fb-root').replaceWith fb_root else $('body').append fb_root loadFacebookSDK = -> window.fbAsyncInit = initializeFacebookSDK $.getScript("//connect.facebook.net/it_IT/all.js") initializeFacebookSDK = -> FB.init channelUrl : 'http://app.heroku.com/page/fbchannel' appId : 'MY_ID_HERE' status : true cookie : true xfbml : true
PageController
class PageController < ApplicationController skip_before_action :authenticate_user! def fbchannel cache_expire = 1.year response.headers["Pragma"] = "public" response.headers["Cache-Control"] = "max-age=#{cache_expire.to_i}" response.headers["Expires"] = (Time.now + cache_expire).strftime("%d %m %Y %H:%I:%S %Z") render :layout => false, :inline => "<script src='//connect.facebook.net/it_IT/all.js'></script>" end end
FBlike (assistant)
def fblike(resource, layout = 'standard') content_tag(:div, "", class:"fb-like", data: { href: polymorphic_url(resource), width: "225", show_faces: false, stream: false, show_border: false, header: false, layout: layout } ) end
source share