我收到了無限量的此消息(如在循環中)和它打破了網站阻止源自「https://www.facebook.com」的框架訪問源自「http://myapp.herokuapp.com」的框架
滑軌4.0.0(與Turbolinks)訪問 與原籍 「http://app.herokuapp.com」 幀凍結與原籍 「https://www.facebook.com」 的幀
錯誤消息
。請求 訪問的幀具有「https」的協議,正被訪問的幀具有「http」的 協議。協議必須匹配。
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(輔助)
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
您的頻道網址必須與Facebook使用的協議相同:您是否嘗試過使用https:// app.heroku.com/page/fbchannel作爲您的channelUrl? – CamilleLDN