仅限 IE8:Facebook Like Box 不显示

发布于 2024-12-10 16:59:10 字数 1999 浏览 6 评论 0原文

所以我和其他许多人一样遇到了一个问题:Facebook Like Box 无法在 IE8 中显示(IE7 正常)。 我发现了很多关于此问题的帖子,尝试了所有解决方案但没有成功...... IE8 消息:FB.FBXML Null 或不是对象

注意:有一个函数可以处理 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

非常感谢

So i've got a problem like many others : Facebook Like Box is not diplaying in IE8 (IE7 OK).
I found many posts about that, tried all solutions but did not succed...
IE8 message : FB.FBXML Null or not an object

NB : there's a function which handle resizing of FB Like Box.

Here's my HTML5 code :

<!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>

Any ideas ?

website : http://www.divstudio.fr/emergenza/jazz/actu.html

thx a lot

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

娇妻 2024-12-17 16:59:10

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

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 中工作

You should add these lines to the tag.

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

If there are already any attributes in the tag, leave them as it is. So that the starting html tag becomes like this.

<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 ?>">

Clear the cache if caching is enabled. It should work in IE-8

翻身的咸鱼 2024-12-17 16:59:10

我遇到了同样的问题,并且添加适当的 xmlns 属性没有帮助。事实证明,导致我的问题与另一个问题有关: 当用户未登录 Facebook 时,类似 Facebook 的框不会显示。 Igy 和 wasim kazi 的答案引导我找到了解决方案。解决该问题的方法如下:

  1. 登录管理您想要在点赞框中反映的页面的 Facebook 帐户。
  2. 在左侧导航栏上,单击“页面”。
  3. 单击页面标题即可打开该页面的管理面板。
  4. 点击编辑页面->编辑设置
  5. 您将看到一个标有“国家/地区限制”的框。如果此框中列出了任何国家/地区,且用户未登录 Facebook,并且在 Internet Explorer (7、8、9) 中该框将为空,则您的“赞”框将为空。这是有道理的:Facebook 能够确定地执行地理限制的唯一方法是确保用户已登录。为什么这会影响 IE(无论用户是否登录)是一个谜,但那是我的案例中问题的原因。

I had the same problem, and adding the appropriate xmlns attributes did not help. As it turns out, what was causing my problem is related to another problem: Facebook like box not showing up when user is not logged into Facebook. Igy and wasim kazi had the answers that led me to the solution. Here's how to solve the problem:

  1. Log onto the Facebook account that manages the page you want reflected in the like box.
  2. On the left nav bar, click on "Pages".
  3. Click on the page title to bring up the admin panel for that page.
  4. Click on Edit Page -> Edit Settings
  5. You'll see a box labeled "Country Restrictions". If there are ANY countries listed in this box, your like box will be blank if the user isn't logged onto Facebook AND it will be blank in Internet Explorer (7, 8, 9). This makes sense: the only way Facebook would be able to enforce geographic restrictions with any certainty would be by making sure the user is logged in. Why this affects IE (whether the user is logged in or not) is a mystery, but that was the cause of the problem in my case.
如梦初醒的夏天 2024-12-17 16:59:10

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

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

,然后我在 部分:

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

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

I had the same issue with the facebook module for drupal 6.

I solved my problem by changing the markup type from XFBML to HTML5

I then added the HTML5 script in the <head> section:

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

I hope this fixes your problem as well.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文