gpt4 book ai didi

ios - 嵌入式 Facebook 帖子在 UIWebView 中无法正确显示

转载 作者:可可西里 更新时间:2023-11-01 06:14:19 25 4
gpt4 key购买 nike

我正在尝试在 UIWebView 中显示 facebook 嵌入的帖子。我从 facebook 开发人员门户获取示例代码并将其加载到 UIWebView 中。并且只看到空白屏幕。

然后我将这段代码放在本地 html 文件中并在 Chrome 中打开它。仍然没有,但我看到嵌入在半秒后出现然后消失了。我尝试了许多不同的嵌入式 html 示例,结果相同。

这是我的代码:

<html>
<body>
<div id="fb-root"></div>
<script>(function (d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s);
js.id = id;
js.src = "https://connect.facebook.net/ru_RU/sdk.js#xfbml=1&version=v2.3&appId=334367389999440";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
<div class="fb-post" data-href="https://www.facebook.com/FacebookDevelopers/posts/10151471074398553" data-width="500">
<div class="fb-xfbml-parse-ignore">
<blockquote cite="https://www.facebook.com/FacebookDevelopers/posts/10151471074398553"><p>Be the first to know
when we release a new video by subscribing to our official Facebook Developers YouTube channel!
http://www.youtube.com/facebookdevelopers</p>Posted by <a
href="https://www.facebook.com/FacebookDevelopers">Facebook Developers</a> on <a
href="https://www.facebook.com/FacebookDevelopers/posts/10151471074398553">29 Май 2013 г.</a>
</blockquote>
</div>
</div>
</body>
</html>

最佳答案

我没有找到在 HTML 中添加脚本的任何理由,正如您所说,您已经在 FB 文档中找到了示例代码。

下面的代码工作正常:-

<html>
<body>
<div id="fb-root"></div>

<div class="fb-post" data-href="https://www.facebook.com/FacebookDevelopers/posts/10151471074398553" data-width="500">
<div class="fb-xfbml-parse-ignore">
<blockquote cite="https://www.facebook.com/FacebookDevelopers/posts/10151471074398553"><p>Be the first to know
when we release a new video by subscribing to our official Facebook Developers YouTube channel!
http://www.youtube.com/facebookdevelopers</p>Posted by <a
href="https://www.facebook.com/FacebookDevelopers">Facebook Developers</a> on <a
href="https://www.facebook.com/FacebookDevelopers/posts/10151471074398553">29 Май 2013 г.</a>
</blockquote>
</div>
</div>
</body>
</html>

关于ios - 嵌入式 Facebook 帖子在 UIWebView 中无法正确显示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30325332/

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