Facebook iframe FB.Canvas.setAutoGrow在初始加载后不会自动增长? [英] Facebook iframe FB.Canvas.setAutoGrow does not auto grow after initial load?
问题描述
我已经使用html和css和Facebooks javascript SDK构建了一个Facebook选项卡。我有iframe调整大小的内容的问题。 p>
我已经设法让它工作在初始加载,这很酷,使用下面的脚本...
< html xmlns =http://www.w3.org/1999/xhtmlxmlns:fb =http://ogp.me/ns/fb#>
-
< div id =fb-root>< / div>
< script type =text / javascript>
window.fbAsyncInit = function(){
FB.init({
appId:'00000000000000',// App ID
channelUrl:'//www.mywebsite.com/ channel.html',// Channel File
status:true,//检查登录状态
cookie:true,//启用Cookie以允许服务器访问会话
xfbml:true / /解析XFBML
});
FB.Canvas.setAutoGrow();
};
//异步加载SDK
(function(d){
var js,id ='facebook-jssdk'; if(d.getElementById(id)){return ;}
js = d.createElement('script'); js.id = id; js.async = true;
js.src =//connect.facebook.net/en_US/all。 js;
d.getElementsByTagName('head')[0] .appendChild(js);
}(document));
< / script>
,我的channel.html看起来像这样...
<?php
$ cache_expire = 60 * 60 * 24 * 365;
header(Pragma:public);
header(Cache-Control:max-age =。$ cache_expire);
header('Expires:'。gmdate('D,d M Y H:i:s',time()+ $ cache_expire)。'GMT');
?>
< script src =// connect.facebook.net/en_US/all.js\"></script>
像我说初始页面加载大小调整是完美的,但是我在iframe中浏览,它不会自动收录到我的内容。
任何人都可以建议,因为我非常新的这个Facebook iframe biz。
提前感谢
请检查这些:
A,您的HTML顶部是否有<!DOCTYPE html>
B,您的应用程式是否会产生有效的HTML?以下是验证器工具: http://validator.w3.org/
I have been building a facebook tab using html and css and facebooks javascript SDK.
I having problems with the iframe resizing to the size of the content.
I've managed to get it to work on initial load which is cool, using this below script...
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="http://ogp.me/ns/fb#">
-
<div id="fb-root"></div>
<script type="text/javascript">
window.fbAsyncInit = function() {
FB.init({
appId : '00000000000000', // App ID
channelUrl : '//www.mywebsite.com/channel.html', // Channel File
status : true, // check login status
cookie : true, // enable cookies to allow the server to access the session
xfbml : true // parse XFBML
});
FB.Canvas.setAutoGrow();
};
// Load the SDK Asynchronously
(function(d){
var js, id = 'facebook-jssdk'; if (d.getElementById(id)) {return;}
js = d.createElement('script'); js.id = id; js.async = true;
js.src = "//connect.facebook.net/en_US/all.js";
d.getElementsByTagName('head')[0].appendChild(js);
}(document));
</script>
and my channel.html looks like this...
<?php
$cache_expire = 60*60*24*365;
header("Pragma: public");
header("Cache-Control: max-age=".$cache_expire);
header('Expires: ' . gmdate('D, d M Y H:i:s', time()+$cache_expire) . ' GMT');
?>
<script src="//connect.facebook.net/en_US/all.js"></script>
Like I said the initial page load resizing is perfect, but as I navigate around the iframe, it does not autogrow to my content.
Can anyone advise as I'm very new to this facebook iframe biz.
Thanks in advance
Please check these:
A, Do you have <!DOCTYPE html>
at the top of the HTML?
B, Do your app generates valid HTML? Here is the validator tool: http://validator.w3.org/
这篇关于Facebook iframe FB.Canvas.setAutoGrow在初始加载后不会自动增长?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!