Facebook评论计数IE8 innerHTML错误

Facebook comments count IE8 innerHTML error

本文关键字:innerHTML 错误 IE8 评论 Facebook      更新时间:2023-09-26

在Internet Explorer 8中,在有<fb:comments-count href="<%= item_url(@item) %>"></fb:comments-count>这样的注释计数标签的页面上,Internet Explorer 8将会出现错误。

无法设置innerHTML:未知运行时错误。
行:40,字符:327
http://connect.facebook.net/en_US/all.js

所有其他Facebook插件(喜欢按钮,评论框)工作正常

我发现facebook的名称空间声明必须在头一级。

I changed from

<html>
  <head prefix="og: http://ogp.me/ns# fb: http://ogp.me/ns/fb# object: http://ogp.me/ns/object#">

<html xmlns:fb="http://ogp.me/ns/fb#">
  <head prefix="og: http://ogp.me/ns# object: http://ogp.me/ns/object#">

,错误消失。

我遵循开放图形名称空间声明:HTML与XMLNS或头部前缀?但是use-prefix-all- way显然在ie8中存在一些问题。

我意识到我也有错误地使用<fb:comments-count>标签,而我在所有其他地方使用HTML5 <div class="fb-comments-count">标签。

如果我把名称空间声明保持原样,但使用正确的HTML5 comments标签,那么错误也会消失。