Facebook comments count IE8 innerHTML error

2019-07-27 03:48发布

On Internet Explorer 8, on pages where there are comments count tags like <fb:comments-count href="<%= item_url(@item) %>"></fb:comments-count>, there will be error in Internet Explorer 8.

Could not set innerHTML: unknown runtime error.
Line: 40, Character: 327
http://connect.facebook.net/en_US/all.js

All other Facebook plugins (like button, comments box) works as expected.

1条回答
叛逆
2楼-- · 2019-07-27 03:58

I found out that the facebook namespace declaration have to be at the head level.

I changed from

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

to

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

and the errors disappeared.

I was following Open Graph namespace declaration: HTML with XMLNS or head prefix? but the use-prefix-all-the-way clearly has some issue with ie8.

Update

I realized that I am also at fault in using the <fb:comments-count> tag by mistake, while I was using the HTML5 <div class="fb-comments-count"> tag in all other places.

If I leave the namespace declaration as it was, but use the correct HTML5 comments tag, then error will also disappear too.

查看更多
登录 后发表回答