내가 페이스 북 버튼을 더 SDK가 없다 나타낼 수 있습니다 : 나는 실행 내 자바 스크립트 파일 내에서 다음 페이지의 변경 때 페이스 북 버튼을 다시로드하지 않습니다FB.init 이미 호출 된 -이
<fb:like href="<%= @canonical_url %>" send="" layout="button_count"></fb:like>
<div id="fb-root"> </div>
<script>
// facebook recommend button
window.fbAsyncInit = function() {
FB.init({appId: 'myappid', status: true, cookie: true, xfbml: true});
};
(function() {
// delay to simulate slow loading of Facebook library - remove this setTimeout!!
var t = setTimeout(function() {
var e = document.createElement('script'); e.async = true;
e.src = document.location.protocol + '//connect.facebook.net/<%= locale_og_tag %>/all.js';
document.getElementById('fb-root').appendChild(e);
}, 0);
}());
</script>
</div>
를 :
if (typeof (FB) != 'undefined') {
FB.init({ status: true, cookie: true, xfbml: true });
} else {
$.getScript("http://connect.facebook.net/en_US/all.js#xfbml=1", function() {
FB.init({ status: true, cookie: true, xfbml: true });
});
}
하지만 콘솔에서 얻을 :
FB.init has already been called - this could indicate a problem
나는이 문제를 해결할 수있는 방법
?
고맙습니다!
Simple -'FB.init()'를 두 번 호출하지 말아라. ** 당신은 ** SDK를로드했다. 그렇지 않으면'FB.init()'를 호출 할 수 없다. – Lix
@Lix는 대답합니다. –
@fra - VTC를 "너무 지역화 된"것으로 VTC해야합니다 ... 그러나 당신이 매우 친절하게 물었 기 때문에 ...;) – Lix