2013-02-23 66 views
0

我的窗口小部件在網站的url包含文件名的情況下工作正常。 F.E.它與 www.domain.com/subdomain/path/index.html並且在網站地址爲www.domain.com/subdomain/path/時總是顯示空白。當網站網址不包含文件名時,facebook發送按鈕空白(index.html)

這是一個有點怪異的行爲,我知道有一些問題與Facebook的發送箱,但我找不到一個適合我的錯誤。

我動態地改變網址,並調用FB.XFBML.parse(); 使用對於Facebook插件然後

<div id="fb-root"></div> 
<script> 
window.fbAsyncInit = function() { 
FB.init({ 
appId  : 'appID', 
    status  : true, 
    cookie  : false, 
    xfbml  : true 
}); 
fbApiInit = true; //init flag 
}; 

(function(d, debug){ 
var js, id = 'facebook-jssdk', ref = d.getElementsByTagName('script')[0]; 
if (d.getElementById(id)) {return;} 
js = d.createElement('script'); js.id = id; js.async = true; 
js.src = "http://connect.facebook.net/en_US/all" + (debug ? "/debug" : "") + ".js"; 
ref.parentNode.insertBefore(js, ref); 

}這樣的碼(文件,/ 調試 /假));

請告訴我該怎麼做。 重要的是,我寧願兩個地址的工作,如果這是不可能的,這將是非常好的機會使用地址沒有filename.ext

回答

0

一切工作正常。 我剛剛意識到Facebook不允許使用發送不擴展地址。 我正在使用 $('.fbMenu :first-child').attr('href',document.location.toString()).attr('ref','text');其中文檔位置只是一個路徑。 這樣一個簡單的代碼修復了問題:

$('.fbMenu :first-child').attr('href',document.location.toString().indexOf('html')==-1?document.location.toString().replace('#','index.html#'):document.location.toString()).attr('ref','text');