2011-11-07 52 views
2

设置我的网页上这样的代码:Facebook发送按钮URI错误

(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); 

能帮忙吗?

回答

0

尝试去除结束 '#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/

+0

同样的错误... :( – Alex