我正在使用 jQuery 创建动态的 Facebook“赞”按钮。但是,我遇到了一个反复重复的错误。
我创建按钮的 jQuery 是:
$('#fbLike').html('<fb:like href="'+url+'" send="false" layout="button_count" width="80" show_faces="true" />');
FB.XFBML.parse(document.getElementById('fbLike'));
但是,我收到以下错误:
Blocked a frame with origin "https://www.facebook.com" from accessing
a frame with origin "http://localhost:8888". The frame requesting
access has a protocol of "https", the frame being accessed has a
protocol of "http". Protocols must match.
有任何想法吗?
编辑
(function(d, s, id) { var js, fjs = d.getElementsByTagName(s)[0]; if (d.getElementById(id)) return; js = d.createElement(s); js.id = id ; js.src = "//connect.facebook.net/en_US/all.js#xfbml=1"; fjs.parentNode.insertBefore(js, fjs); }(文档, '脚本', 'facebook-jssdk') );