Facebook Canvas APP(Iframed)自动调整大小 [英] Facebook Canvas APP (Iframed) Auto-Height Resize
问题描述
有没有人有这个问题或想出一个解决方案?
谢谢!
Erik
在< / body>
我写了以下代码。
< div id =fb-root>< ; / DIV>
< script type =text / javascript>
window.fbAsyncInit = function(){
FB.init({
appId:'<??php echo YOUR_APP_ID?>',
cookie:true,
xfbml:true,
oauth:true
});
FB.Canvas.setAutoGrow(true);
};
(function(){
var e = document.createElement('script'); e.async = true;
e.src = document.location.protocol +
' //connect.facebook.net/en_US/all.js';
document.getElementById('fb-root')。appendChild(e);
}());
< / script>
这对我来说很正常。
在高级应用程序设置中 height
是 Fixed或Fluid
无关紧要。
FB.Canvas.setAutoGrow(true);
在我的应用程序中不工作,但是我发现我错过了< div id =fb-root>< / div>
代码。我只是把它放在< script type =text / javascript>
之前,解决了问题。
Been running into an issue lately with Facebook canvas iframe applications. I've set our settings to "auto-resize" and implemented the correct FB JS call to do the resizing of the height (to avoid unwanted scrollbars), but it doesn't seem to be working.
Has anyone else had this issue or come up with a solution?
Thanks!
Erik
Before </body>
tag, I have written following code.
<div id="fb-root"></div>
<script type="text/javascript">
window.fbAsyncInit = function() {
FB.init({
appId: '<?php echo YOUR_APP_ID ?>',
cookie: true,
xfbml: true,
oauth: true
});
FB.Canvas.setAutoGrow(true);
};
(function() {
var e = document.createElement('script'); e.async = true;
e.src = document.location.protocol +
'//connect.facebook.net/en_US/all.js';
document.getElementById('fb-root').appendChild(e);
}());
</script>
And it is working fine for me.
It doesn't matter whether height
is Fixed or Fluid
in Advanced application settings.
FB.Canvas.setAutoGrow(true);
was not working in my application, but I found that I missed the <div id="fb-root"></div>
code. I just put it before <script type="text/javascript">
and got the issue resolved.
这篇关于Facebook Canvas APP(Iframed)自动调整大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!