본문 바로가기

카테고리 없음

[facebookapp] facebook app iframe size

저녁 내내 이거 찾고 다녔다.

역시 모르면 생고생한다..

일단 정리하자면, Canvas 로 설정된 이상 기본 셋팅은

앱 - > appname - >Advanced


Advanced에서 설정이 된다는 것이다.


캔버스 설정에 width 값이 설정되어 있다.  이걸 Fluid 로 설정하면 된다. ㅜ


그리고 구글을 통해 알게된 정보들이다.

10 down vote accepted

Setting your Canvas Size option to Resizable Iframe does not in itself make the canvas automatically resize to conform to your content. There's a couple of other things you have to do. Check out the Resizable IFrame wiki page for the full instructions.

You basically have to create an HTML page known as a "cross-domain receiver" (which is as simple as copying and pasting their example file), and then copy a snippet of Javascript code on the bottom of all your application pages. The Javascript will perform a resize of the iframe once the content has loaded.

The wiki page has improved since the last time I used it, so hopefully it's fairly straightforward. If you run into problems getting it working, make sure you check that you've modified the javascript snippet appropriately so that it points to your cross-domain receiver page.

Update Jan 2011 - Some comments coming in, so I thought I'd update. I believe this answer is still more or less correct, although the documentation has changed. Facebook has moved away from FBML, and updated their Javascript SDKs. The current method to load the Javascript SDK is found on the main Javascript SDK page, and at the bottom are the methods you can use for resizing the canvas, FB.Canvas.setAutoResize() and FB.Canvas.setSize(). You still need to set your canvas as resizable in the app's Developer settings. It looks like they may have replaced the need for a cross-domain file with the new SDK, but I haven't tested it yet myself.

결국 말하자면, 캔버스 앱에서 사이즈 조절은 FB.Canvas.setAutoResize() and FB.Canvas.setSize(). 으로 가능하다는것이고, 관련 API주소는 https://developers.facebook.com/docs/reference/javascript/FB.Canvas.setSize/