简体   繁体   English

XFBML Like按钮无法在IE9中呈现

[英]XFBML Like button not rendering in IE9

I've been trying to troubleshoot this issue for a while with no success. 我一直在尝试解决此问题一段时间,但没有成功。

I've got a contest page set up at https://mantry.com/giveaway/ , on which I have two Facebook Like buttons (these have been used in lieu of the Facebook Like Box because I was having issues with the well documented edge.subscribe event not firing). 我在https://mantry.com/giveaway/上设置了一个比赛页面,上面有两个Facebook Like按钮(已使用它们代替了Facebook Like Box,因为我在记录良好的文档上存在问题edge.subscribe事件未触发)。

Basically, everything is working in Mozilla, Chrome & Safari, but in IE9 / IE8, the fb:like buttons are not rendering. 基本上,所有功能都可以在Mozilla,Chrome和Safari中运行,但是在IE9 / IE8中,不会渲染fb:like按钮。

I've declared my xml name space as follows: 我已经声明了我的xml名称空间,如下所示:

<script>
window.fbAsyncInit = function() {
FB.init({
  appId      : '274762932654075', // App ID
  channelUrl : '//mantry.com/channel.php', // Channel File
  status     : true, // check login status
  xfbml      : true  // parse XFBML
});

FB.XFBML.parse(document.getElementById('fb1'));
FB.XFBML.parse(document.getElementById('fb2'));

// Additional initialization code here
FB.Event.subscribe('edge.create', function(href) {
    if(href == 'http://www.facebook.com/themantry'){
        social[0] = 1;
    };
    if(href == 'http://www.facebook.com/<?php echo get_post_meta( $post->ID, 'contest_fb', true);?>'){
        social[1] = 1;
    };
    socialClick();
});

};

// Load the SDK Asynchronously
(function(d){
 var js, id = 'facebook-jssdk', ref = d.getElementsByTagName('script')[0];
 if (d.getElementById(id)) {return;}
 js = d.createElement('script'); js.id = id; js.async = true;
 js.src = "//connect.facebook.net/en_US/all.js";
 ref.parentNode.insertBefore(js, ref);
 }(document));
</script>

I tried both with and without the FB.XFBML.parse(), neither worked for me. 无论是否使用FB.XFBML.parse(),我都尝试过,但都不适合我。

The fb:like elements, in case it is relevant are as follows: 如果相关,则fb:like元素如下:

<fb:like href="http://www.facebook.com/themantry" send="false" width="450" show_faces="false" font="" data-layout="button_count" id="fb1"></fb:like>

Any ideas would be greatly appreciated, and happy to elaborate on anything I might have omitted. 任何想法都将不胜感激,并乐于阐述我可能省略的任何内容。 Thanks in advance! 提前致谢!

I figured out what was wrong here, thought I'd post in case anyone else is running into the same issue as me. 我发现这里出了什么问题,以为我可以发帖,以防其他人遇到与我相同的问题。

I had the like buttons in a div that was hidden, which only became visible once the user had connected to Facebook. 我在隐藏的div中有类似的按钮,只有在用户连接到Facebook后,该按钮才可见。 Looks like there is issues with parsing FBML on hidden elements, so I ended up moving FB.XFBML.parse(); 看起来在隐藏元素上解析FBML存在问题,因此我最终移动了FB.XFBML.parse();。 to fire after the elements became visible. 在元素变得可见之后触发。

ie

$('.fb-connect').hide();
$('.fb-boxes').fadeIn(200,function(){
        FB.XFBML.parse();
    });

Now it is working correctly in IE9. 现在,它在IE9中可以正常工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM