2012-06-05 19 views
-2

我正在開發一個FB應用程序與PHP。它與大多數瀏覽器一起工作。在某些瀏覽器中的FB應用程序鏈接和提交按鈕的問題

但是,當我按下圖像鏈接或按鈕時會出現問題,會發生什麼情況是整個頁面會重新加載並保留在同一頁面中。因此,如果我在index.php中,並且它爲next.php設置的鏈接,頁面將重新加載並繼續在index.php中。這發生在IE 9中,奇怪的是,這發生在我的一個朋友的Firefox使用相同的版本,但在Mac上(我在另一臺PC上測試,並在Firefox,鉻和歌劇)工作正常。

此問題發生在Safari瀏覽器,但我可以通過改變來解決這一切絕對URL的相對URL,但問題仍然存在於IE瀏覽器,它有時會出現在Firefox ...

我已經刪除了http://validator.w3.org/中的代碼。 我使用Win 7.

任何幫助或建議,它可能是它的歡迎,在這一點上,我很無能。

下面的代碼:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<?php 
session_start(); 

$_SESSION = array(); 

require_once "configuration/config.php"; 

$friends = $facebook->api('me/friends'); 

if(count($friends['data']) < 20) 
    header('Location: https://tratamentoquedadecabelo.com/diogo/notEnough.php'); 

$query_user_participant = "SELECT id FROM user WHERE id = $fb_user_id AND participant = 1"; 

$query_minimum_answers = "SELECT * FROM survey_answers WHERE User_has_friend_User_id = $fb_user_id"; 

$res_query_minimum_answers = mysql_query($query_minimum_answers); 

$res_query_user_participant = mysql_query($query_user_participant); 

if($res_query_user_participant == true && mysql_num_rows($res_query_minimum_answers) > 19) 
{ 
    //user already did the study 
    header('Location: https://tratamentoquedadecabelo.com/diogo/studyAlreadyDone.php'); 
} 

?> 

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> 
    <head> 
     <meta http-equiv="Content-type" content="text/html;charset=UTF-8" /> 
     <title></title> 
     <link rel="stylesheet" type="text/css" href="css/style.css" /> 
    </head> 
    <body> 
     <div id="fb-root"></div> 
     <script src="https://connect.facebook.net/en_US/all.js"></script> 
     <script type="text/javascript"> 
      FB.init({ 
      appId : '********************', 
      status : true, // check login status 
      cookie : true, // enable cookies to allow the server to access the session 
      xfbml : true // parse XFBML 
      }); 
     </script> 
    <script type="text/javascript"> 
     FB.Canvas.setSize({ width: 800, height: 715 }); 
    </script> 
     <br/> 
     <h2 id="lang_title">Choose language</h2> 
      <div id="british"> 
       <a href="https://tratamentoquedadecabelo.com/diogo/startPage.php?language=british"> 
        <img class="effect" src="https://tratamentoquedadecabelo.com/diogo/images/british.jpg" width="200" height="150" alt="british_flag" /></a> 
      </div> 
      <div id="portuguese"> 
       <a href="https://tratamentoquedadecabelo.com/diogo/startPage.php?language=portuguese"> 
        <img class="effect" src="https://tratamentoquedadecabelo.com/diogo/images/portuguese.jpg" width="200" height="150" alt="portuguese_flag" /></a> 
      </div> 
    </body> 
</html> 
+1

代碼?或者我們應該猜測? – 2012-06-05 22:04:44

+0

對不起,但這基本上發生在所有頁面,但這裏是第一頁... –

+1

兩個指針:1)添加「exit();」重定向標題。否則,其餘的代碼會被執行。 2)我按照你描述的那樣刷新頁面,然後通常是javascript錯誤。在你的例子中沒有javascript,所以要麼調試JavaScript,要麼添加到你的答案中。 – Robbie

回答

0

通過在文件開始寫這行代碼解決Internet Explorer的問題:

header('P3P:CP="IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT"'); 

的問題是,默認情況下,IE不允許第三方cookie。更多關於這個here。 因此,如果用戶手動禁用第三方cookie,這種問題將持續存在。