2013-06-11 66 views
0

我在瀏覽器在查看源代碼的作品facebbok內碼在它創建一個表單,這Facebook應用不會在谷歌瀏覽器中加載。在所有瀏覽器加載即直至

<form method="post" id="proxy_form"> <input type="hidden" autocomplete="off" id="signed_request" name="signed_request" /> </ form> <script> document.domain = "facebook . to "; 
   FrameName window.location.href.split var = ('#') [1]; 
   submitForm function (appTabUrl, signedRequest) { 
     var proxyForm = document.getElementById ("proxy_form"); 
     proxyForm.setAttribute ("action", appTabUrl); 
     proxyForm.setAttribute ("target", FrameName); 
     var input = document.getElementById ("signed_request"); 
     input.setAttribute ("value", signedRequest); 
     proxyForm.submit(); 
   } 
   waitForParams function() { 
     if (parent.PlatformAppController && 
           parent.PlatformAppController.getFrameParams (FrameName) && 
         document.getElementById ("proxy_form") && 
         document.getElementById ("signed_request")) { 
       var params = 
         parent.PlatformAppController.getFrameParams (FrameName); 
       submitForm (params.appTabUrl, params.signedRequest); 
     Else {} 
       setTimeout (waitForParams, 10); 
     } 
   } 
   waitForParams(); </ script> <div <noscript> class="pam uiBoxGray"> You need to enable Javascript in your browser to use Facebook Applications. </ div> </ noscript> 

我啓用javascript和II試驗了3臺不同的機器

回答

1

我有這個代碼,它不適用於Chrome(僅適用於粉絲)。對於非粉絲,它會正確顯示圖像。

我只是改變了我的重定向到一個HTTPS和它的工作! :) 它看起來像鉻重定向到http有問題。只需在所有鏈接中添加「s」即可。

注意隱藏重定向的,如果你有一個參數,URL或類似的東西,你有沒有要加「S」兩次:開頭(https://www.myweb.com/r.php ?),並在中間(&url=https%3A//www.myweb.es

希望它有助於!

一個例子:

<?php 

require 'facebook.php'; 

$app_id = "384609344916003"; 
$app_secret = "f615dfb4c787d05d5f1a2fbefd11cadc"; 
$facebook = new Facebook(array(
     'appId' => $app_id, 
     'secret' => $app_secret, 
     'cookie' => true 
)); 

$signed_request = $facebook->getSignedRequest(); 

$page_id = $signed_request["page"]["id"]; 
$page_admin = $signed_request["page"]["admin"]; 
$like_status = $signed_request["page"]["liked"]; 
$country = $signed_request["user"]["country"]; 
$locale = $signed_request["user"]["locale"]; 

if ($like_status) { 

    if ($page_id == '1234567890'){ 
    // UK 
     header("HTTP/1.1 301 Moved Permanently"); 
     header("Location: https://www.myweb.com/fbpromo/"); 
     exit(); 
    } 
} 
else { 
    echo "<link type='text/css' rel='stylesheet' href='facebook_new.css'/>"; 
    echo "<body>"; 
    if ($page_id == '1234567890'){ 
     //English 
     echo "<img src='http://www.myweb.com/img/facebook/FB-app-non-fans.jpg' alt='Like us' /> "; 
    } 
} 

echo "</body>"; 

?> 
相關問題