【问题标题】:Facebook Send Button URI-errorFacebook 发送按钮 URI 错误
【发布时间】:2011-12-23 10:18:23
【问题描述】:

在我的页面上设置此代码:

(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/ru_RU/all.js?#xfbml=1";
  fjs.parentNode.insertBefore(js, fjs);}(document, 'script', 'facebook-jssdk'));

在 Opera(最新版本) 和 IE(7,8,9) 中出现 js 错误:

IE - URI-error: http://connect.facebook.net/ru_RU/all.js?#xfbml=1

歌剧-

   Event thread: message
    Uncaught exception: URIError: Malformed URI
    Error thrown at line 5, column 622 in <anonymous function: decode>(f) in http://connect.facebook.net/ru_RU/all.js?:
        d[a(c[0])]=a(c[1]||'');
    called from line 12, column 4409 in <anonymous function: recv>(b) in http://connect.facebook.net/ru_RU/all.js?:
        b=FB.QS.decode(b);
    called from line 12, column 5266 in <anonymous function: onMessage>(event) in http://connect.facebook.net/ru_RU/all.js?:
        FB.XD.recv(event.data);

可以帮忙吗?

【问题讨论】:

    标签: facebook button send xfbml


    【解决方案1】:

    这似乎是一个 facebook 错误 http://developers.facebook.com/bugs/156272457812857

    【讨论】:

      【解决方案2】:

      尝试从末尾删除 '?#xfbml=1':

      window.fbAsyncInit = function() {
          FB.init({
            appId      : 'YOUR_APP_ID', // App ID
            channelURL : '//WWW.YOUR_DOMAIN.COM/channel.html', // Channel File
            status     : true, // check login status
            cookie     : true, // enable cookies to allow the server to access the session
            oauth      : true, // enable OAuth 2.0
            xfbml      : true  // parse XFBML
          });
      
          // Additional initialization code here
        };
      
        // Load the SDK Asynchronously
        (function(d){
           var js, id = 'facebook-jssdk'; if (d.getElementById(id)) {return;}
           js = d.createElement('script'); js.id = id; js.async = true;
           js.src = "//connect.facebook.net/ru_RU/all.js";
           d.getElementsByTagName('head')[0].appendChild(js);
         }(document));
      

      https://developers.facebook.com/docs/reference/javascript/

      【讨论】:

        猜你喜欢
        • 2012-02-26
        • 2012-07-17
        • 2012-03-06
        • 2013-09-02
        • 1970-01-01
        • 2013-06-23
        • 1970-01-01
        • 2012-09-01
        • 1970-01-01
        相关资源
        最近更新 更多