2012-06-08 61 views
0

我有在asp.net mvc3,其中有產品列表,用戶點擊一個產品時,用戶轉到另一個視圖與產品詳細信息,問題是,像facebook按鈕在頁面加載完成時不顯示。但是,如果我刷新頁面,則會顯示Google plus plus按鈕正常工作的位置。幫助PLZ。facebook喜歡的按鈕不顯示在第一個請求

<!DOCTYPE html> 
<html> 
    <head> 
     <meta charset="utf-8" /> 
     <meta name="viewport" content="initial-scale=1.0, width=device-width, height=device-height,user-scalable=no" /> 
     <title>xxxxxxxx</title> 
     <link href="/Content/Site.css" rel="stylesheet" type="text/css" /> 
     <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" type="text/javascript"> </script> 
     <link href="/Content/JqueryContent/themes/base/jquery.ui.all.css" rel="stylesheet" type="text/css" /> 
     <script src="/Content/JqueryContent/jquery.ui.core.js.js" type="text/javascript"></script> 
     <script src="/Content/JqueryContent/jquery.ui.widget.js.js" type="text/javascript"></script> 
     <script src="/Content/JqueryContent/jquery.ui.position.js" type="text/javascript"></script> 
     <script src="/Content/JqueryContent/jquery.ui.autocomplete.js" type="text/javascript"></script> 
     <link rel="stylesheet" href="http://code.jquery.com/mobile/1.1.0/jquery.mobile-1.1.0.min.css" /> 
     <script src="http://code.jquery.com/mobile/1.1.0/jquery.mobile-1.1.0.min.js" type="text/javascript"> </script> 
    </head> 
    <body> 
    <div id="fb-root"></div> 
    <script type="text/javascript"> 
      window.fbAsyncInit = function() { 
       FB.init({ 
       appId  : 'xxxxxxxxxxxx', 
       status  : true, 
       cookie  : true, 
       xfbml  : true, 
       oauth  : true, 
       }); 
       FB.Event.subscribe('auth.statusChange', handleStatusChange); 
      }; 

      (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/en_US/all.js"; 
       d.getElementsByTagName('head')[0].appendChild(js); 
      }(document)); 
    </script> 
    <header data-role="header" data-theme="a"><h3>xxxxx</h3></header> 
    <div data-role="content"> 
    <div class="fb-like" data-send="true" data-width="450" data-show-faces="true"></div> 
    <style>.fb_edge_comment_widget {display: none !important; }</style> 
    <div class="g-plusone" data-size="medium"></div> 
    <script type="text/javascript" src="https://apis.google.com/js/plusone.js"></script>  
    </div> 
    <footer data-role="footer" data-theme="a" style="font-family:Trebuchet MS;"><h5></h5></footer> 
</body> 
</html> 
+0

您可能需要發佈一些代碼示例或提供鏈接。我不確定這是否足以回答您的問題。 – shanabus

+0

我已添加代碼,請檢查它 –

回答

0

您可能需要更新您的FB sdk片段。我只是檢查了Facebook的Javascript SDK頁面,它這樣做:

// Load the SDK Asynchronously 
    (function(d){ 
    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 = "//connect.facebook.net/en_US/all.js"; 
    ref.parentNode.insertBefore(js, ref); 
    }(document)); 

通知新的方法用於插入JS,insertBefore()。也許這會有所幫助。

乾杯!

+0

不能正常工作,存在同樣的問題 –

+0

您是否驗證過fb sdk腳本已加載到dom中?另外,FB對象的狀態值是什麼? – shanabus

+0

是的,它被加載,但最初沒有顯示類似的按鈕 –