嗨,我在网上使用Facebook上的按钮。我所有的内容都是通过ajax加载的,我已经知道如果你想使用带有加载内容的Ajax按钮的Facebook,你应该使用FB.XFBML.parse()
。我用过这个,它运行得很好,是Firefox和Chrome,但它不能在IE中工作。我正在使用IE 8进行检查。我已搜索解决方案,并发现here在我的html标记中添加xmlns:fb="http://www.facebook.com/2008/fbml"
。我做了,但它尚未修复。我的代码看起来像FB.XFBML.parse在IE中不工作
layout.php
<div id="fb-root" style="display:none"></div>
<script>
window.fbAsyncInit = function() {
FB.init({
appId : 'APPID', // App ID
status : true, // check login status
cookie : true, // enable cookies to allow the server to access the session
xfbml : true // parse XFBML
});
// Additional initialization code here
};
(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_GB/all.js#xfbml=1";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
</script>
这就是我如何使用XFBML.parse
$(".fblike").each(function(){
FB.XFBML.parse($(this).get(0));
//because having multiple likes button on same page.
});
这里是我的喜欢按钮
<div class='fblike'><fb:like send='false' layout='button_count' width='100' show-faces='false' href='www.myurl.com?ref=facebook' ></fb:like></div>
如何使其与IE8和IE9的工作?我错在哪里以及如何解决这个问题?
问候,
可能重复http://stackoverflow.com/questions/3758846/facebook-login-like-fail-on-ie8 – Venu
@ Venu我已经遵循了这些说明,但我的问题仍然存在? –
你有没有试过Array.prototype.indexOf? – Venu