2

所以我遇到了和其他许多人一样的问题:Facebook Like Box 没有在 IE8 中显示(IE7 OK)。我发现了很多关于此的帖子,尝试了所有解决方案但没有成功... IE8 消息:FB.FBXML Null or not an object

注意:有一个函数可以处理 FB Like Box 的大小调整。

这是我的 HTML5 代码:

<!doctype html>
<!--[if IE 8]>    <html class="no-js ie8 oldie" lang="fr" xmlns="http://www.w3.org/1999/xhtml" xmlns:og="http://opengraphprotocol.org/schema/"  xmlns:fb="http://www.facebook.com/2008/fbml"><![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="fr"> <!--<![endif]-->
<head>
...
    <script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script>
</head>
<body>
...
    <article>
    <div class="row" id="content">
            <div class="twelvecol last">
            <div id="fb-root"></div>
                <div class="fb-like-box" data-href="http://www.facebook.com/divstudio" data-width="1140" data-show-faces="true" data-stream="true" data-header="false"></div>
            </div>
    </div>
    </article>
...

<script>
$(document).ready(function(){
        var contentwidth = $('#content').width();
        $('.fb-like-box').attr('data-width', contentwidth - '40');
        FB.FBXML.parse(document.getElementsByClassName('.fb-like-box'));
});
</script> 

 <script>(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);
                }(document, 'script', 'facebook-jssdk'));</script>      
</body>
</html>

有任何想法吗 ?

网站:http ://www.divstudio.fr/emergenza/jazz/actu.html

多谢

4

3 回答 3

4

您应该将这些行添加到标签中。

xmlns="http://www.w3.org/1999/xhtml" xmlns:og="http://opengraphprotocol.org/schema/"
xmlns:fb="http://www.facebook.com/2008/fbml"

如果标签中已经有任何属性,请保持原样。这样开始的html标签就变成了这样。

<html xmlns="http://www.w3.org/1999/xhtml" xmlns:og="http://opengraphprotocol.org/schema/" xmlns:fb="http://www.facebook.com/2008/fbml" lang="<?php print $language->language ?>" xml:lang="<?php print $language->language ?>" dir="<?php print $language->dir ?>">

如果启用缓存,请清除缓存。它应该在 IE-8 中工作

于 2012-04-10T19:56:16.200 回答
3

我有同样的问题,添加适当的 xmlns 属性没有帮助。事实证明,导致我的问题的原因与另一个问题有关:当用户未登录 Facebook 时,Facebook like box 没有出现。Igy 和 wasim kazi 的答案让我找到了解决方案。以下是解决问题的方法:

  1. 登录管理您希望在“赞”框中反映的页面的 Facebook 帐户。
  2. 在左侧导航栏上,单击“页面”。
  3. 单击页面标题以显示该页面的管理面板。
  4. 点击编辑页面 -> 编辑设置
  5. 您会看到一个标有“国家/地区限制”的框。如果此框中列出了任何国家/地区,如果用户未登录 Facebook,您的点赞框将为空白,并且在 Internet Explorer (7, 8, 9) 中为空白。这是有道理的:Facebook 能够确定地执行地理限制的唯一方法是确保用户已登录。为什么这会影响 IE(无论用户是否登录)是一个谜,但那是在我的情况下问题的原因。
于 2013-05-10T01:33:09.173 回答
0

我对 drupal 6 的 facebook 模块有同样的问题。

我通过将标记类型从XFBML 更改HTML5解决了我的问题

然后,我在该部分中添加了 HTML5 脚本<head>

<!--[if lt IE 9]>
  <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->

我希望这也能解决您的问题。

于 2012-01-06T21:01:45.783 回答