2012-03-07 1 views
1
를 작동하지
<html> 
<head> 
    <title>Fluid Width HTML Example </title> 
</head> 

<body style="margin:0; padding:0; border:0; background-color:#000000;width:1500px"> 

    <div id="fb-root"></div> 
      <script> 
       window.fbAsyncInit = function() { 
       FB.init({ 
        appId : 'xxxxxxxxxxxxx', 
        status : true, // check login status 
        cookie : true, // enable cookies to allow the server to access the session 
        xfbml : true, // parse XFBML 
        // channelUrl : 'http://www.yourdomain.com/channel.html', // Custom Channel URL 
        oauth : true //enables OAuth 2.0 
       }); 

       FB.Canvas.setSize({width:1200}); 

       }; 

       (function() { 
       var e = document.createElement('script'); 
       e.src = document.location.protocol + '//connect.facebook.net/en_US/all.js'; 
       e.async = true; 
       document.getElementById('fb-root').appendChild(e); 
       }()); 
      </script> 

    <div id="allContent" style="background-color: #0000FF; height:50%;width:100%"> 
     <div id="output" style="color: #FFFFFF;" /> 
    </div> 

    </body> 
</html> 

나는 1200 내 캔버스 페이지 폭을 확장하고 싶지만, 캔버스 폭이 I가 '캔버스 폭'을 설정 않았다 (아직 760이기 때문에 내 코드가 작동하지 보인다 캔버스 설정의 유체), 내가 만든 실수를 누군가에게 말해 줄 수 있습니까? 내 코드는 다음과 같습니다. -FB.Canvas.setSize는

감사합니다. 좋은 하루 되세요.

답변

0

setSize가 더 이상 사용되지 않습니다. autoGrow를 사용하고 CSS를 사용하여 너비를 설정해보십시오.

window.fbAsyncInit = function() { 
    FB.init({ 
     appId : 'xxxxxxxxxxxxx', 
     status : true, // check login status 
     cookie : true, // enable cookies to allow the server to access the session 
     xfbml : true, // parse XFBML 
     // channelUrl : 'http://www.yourdomain.com/channel.html', // Custom Channel URL 
     oauth : true //enables OAuth 2.0 
     }); 

     FB.Canvas.setAutoGrow(true); 
    }; 

다음 CSS에서 본문 너비를 1200으로 설정할 수 있습니다.

+0

감사 벤, 지금 그것을 시도하는 경우를 대비하여, 자신의 URL을 확인합니다. –

+0

나는 당신의 코딩을 시도했지만, 결과는 여전히 동일합니다 ... 내가 코딩 전에하지 않은 것은 무엇입니까? –

+0

앱 설정 (고급 아래)에서 캔버스 너비와 높이를 "fluid"로 설정해야합니다. 자동 실행이 실행되기 전에 시간 초과를 늘릴 수도 있습니다. 페이지를로드하는 데 시간이 오래 걸리는 경우입니다. 대기 시간 (밀리 초)을 전달할 수 있습니다. 기본값은 100입니다. 예 : FB.Canvas.setAutoGrow (200); – Ben

0

대부분의 사람들은 자신의 보안 HTTPS를 설정하는 것을 잊지 :

Page Tab URL:   http://... 
Secure Page Tab URL:  https://...