gpt4 book ai didi

javascript - Facebook iframe FB.Canvas.setAutoGrow 在初始加载后不会自动增长?

转载 作者:塔克拉玛干 更新时间:2023-11-02 21:36:05 24 4
gpt4 key购买 nike

我一直在使用 html 和 css 以及 facebooks javascript SDK 构建一个 facebook 选项卡。

我在根据内容大小调整 iframe 时遇到问题。

我已经设法让它在初始加载时工作,这很酷,使用下面的脚本...

<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>

我的 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 业务很陌生。

提前致谢

最佳答案

请检查这些:

A,你有<!DOCTYPE html>吗?在 HTML 的顶部?

B,您的应用是否生成有效的 HTML?这是验证器工具:http://validator.w3.org/

关于javascript - Facebook iframe FB.Canvas.setAutoGrow 在初始加载后不会自动增长?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9197411/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com