0
我試圖在頁面上實現一個XFBML評論框。它適用於Firefox和Chrome瀏覽器,但只能在Internet Explorer 8中零星地使用。Facebook XFBML和Internet Explorer 8異步加載問題
當頁面遇到FB.XFBML.parse('fb-stuff');
時,出現'FB is undefined'錯誤。在嘗試解析XFBML之前,是否需要檢查Facebook Connect腳本是否已完成加載?
<script type="text/javascript">
window.fbAsyncInit = function() {
FB.init({
appId : '117378991625799',
status : false, // check login status
cookie : false, // enable cookies to allow the server to access the session
xfbml : true // parse XFBML
});
};
(function() {
var e = document.createElement('script');
e.src = document.location.protocol + '//connect.facebook.net/en_US/all.js';
e.async = true;
document.getElementById('fb-root').appendChild(e);
FB.XFBML.parse('fb-stuff');
}());
</script>