【发布时间】:2018-03-25 19:00:57
【问题描述】:
回到另一个问题,但这次与 SQL 无关!!
我正在创建一个允许用户注册和发布帖子的网站。当他们注册时,他们可以输入 Facebook 页面名称,我希望能够将该页面嵌入到他们的个人资料页面中,这样当人们查看他们的个人资料时,Facebook 页面将显示在一个小窗口中。我去了 Facebook 的 Page Plugin 页面,但我不确定这是实现我想要的最佳方式。我做了很多搜索,但没有任何运气。
我尝试在网站中只放置一个页面的代码,但它总是出现空白。这是我从页面插件网站得到的:
<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/en_US/sdk.js#xfbml=1&version=v2.12';
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
<div class="fb-page" data-href="https://www.facebook.com/KeenesListcom-126649220715963/" data-tabs="timeline" data-small-header="false" data-adapt-container-width="true" data-hide-cover="false" data-show-facepile="true"><blockquote cite="https://www.facebook.com/KeenesListcom-126649220715963/" class="fb-xfbml-parse-ignore"><a href="https://www.facebook.com/KeenesListcom-126649220715963/">KeenesList.com</a></blockquote></div>
感谢任何帮助。
编辑
好的,所以问题实际上出在 Google Chrome 上。我在 IE 11 和 Firefox 中尝试过,页面加载正常。仍然需要弄清楚为什么它没有在 Chrome 中加载。
第二次编辑
好的,这很奇怪。我使用 iframe 显示了 3 个不同的项目。 Facebook 页面、Strava 活动日志和 Trailforks 活动日志。 Strava 和 Trailforks 项目显示正常,但 Facebook 页面出于某种原因却没有。这仅在 Chrome 中,Facebook 在 Firefox 和 IE 中运行良好。这是我的代码:
<iframe src=https://www.facebook.com/plugins/page.php?href=https%3A%2F%2Fwww.facebook.com%2Fmountainbikingintheus%2F&tabs=timeline&width=350&height=400&small_header=false&adapt_container_width=true&hide_cover=false&show_facepile=true&appId width=350 height=400 style=border:none;overflow:hidden scrolling=no frameborder=0 allowTransparency=true></iframe>
<iframe height=160 width=300 frameborder=0 allowtransparency=true scrolling=no src=https://www.strava.com/athletes/21039441/activity-summary/947ebf6e987358db8c8785041ad46b5a4d4ea7c5></iframe>
<iframe width=400 height=277 frameborder=0 src=https://www.trailforks.com/widgets/ridelogs/?userid=1306231&w=400px&h=277px&map=0&stats=1></iframe>
第三次编辑:完整代码
这是我的完整代码。我将页面剥离到最低限度,但仍然遇到问题。我尝试了多台计算机,但在 Firefox 和 IE 中工作时,它仍然无法在 Chrome 中显示。
<html>
<head>
<title>Test IFrame</title>
</head>
<body>
<iframe src="https://www.facebook.com/plugins/page.php?href=https%3A%2F%2Fwww.facebook.com%2Fmountainbikingintheus%2F&tabs=timeline&width=350&height=400&small_header=false&adapt_container_width=true&hide_cover=false&show_facepile=true&appId" width="350" height="400" style="border:none;overflow:hidden" scrolling="no" frameborder="0" allowTransparency="true"></iframe>
</body>
</html>
【问题讨论】:
标签: php facebook iframe plugins