FB Share button Javascript error in IE8

送分小仙女□ 提交于 2019-12-22 12:19:40

问题


I am getting a javascript error for the FB Share button only in IE8. This started after the old Share button was disabled and subsequently re-enabled (see Facebook Share button: is it officially dead?)

The error I am getting is:

Message: Object doesn't support this property or method
FB.Share                                                    Line: 128
Code: 0                                                     Char: 188
URI: http://static.ak.fbcdn.net/connect.php/js/FB.Share

Any ideas on how to fix this?


回答1:


How about doing it this way?

http://www.facebook.com/sharer.php?s=100&p[title]=SHARE%20ME&p[summary]=SOME%20CONTENT&p[url]=http://www.google.com&p[images][0]=http://fakeurl.com/shareImage.gif

Breakdown:

http://www.facebook.com/sharer.php?s=100 - MAIN URL
&p[title]=SHARE%20ME - SHARE TITLE
&p[summary]=SOME%20CONTENT - SHARE PARAGRAPH
&p[url]=http://www.google.com - URL TO SHARE
&p[images][0]=http://fakeurl.com/shareImage.gif - SHARE IMAGE THUMBNAIL




回答2:


I had a similar issue and removing the following line worked for me after hours of searching online.

<meta http-equiv="X-UA-Compatible" content="IE=7"/>



回答3:


I used a slightly modified version of the answer in the link I gave originally:

<html xmlns:fb="http://ogp.me/ns/fb#" lang="en">
  <head prefix="og: http://ogp.me/ns# fb: http://ogp.me/ns/fb#">
  </head>
  <body>
    <div id="fb-root"></div>
    <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&appId=YOUR_APP_ID"; // appId must be valid
      fjs.parentNode.insertBefore(js, fjs);
    }(document, 'script', 'facebook-jssdk'));</script>
    <fb:share-button type="button" href="http://www.foobar.com"></fb:share-button>
  </body>




回答4:


What I found is that if you can set IE8 in protected mode by selecting Internet options -> Security ->Trusted Sites ->Enable Protected Mode, the page is working fine.



来源:https://stackoverflow.com/questions/11594442/fb-share-button-javascript-error-in-ie8

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!