2013-06-11 3 views
0

작품은 코드 내에서 그 위에 양식을 만들 facebbok이Google 크롬에서 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
을 테스트 할 때까지 모든 브라우저에서 하중 즉,

나는이 코드를 가지고 있으며 크롬에서는 작동하지 않습니다 (팬만 해당). 비 팬의 경우 이미지를 올바르게 표시했습니다.

방금 ​​내 리디렉션을 HTTPS으로 변경했습니다. :) Chrome에 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>"; 

?> 
관련 문제