我只是试图将facebook sharer页面加载到iframe中,该iframe位于div中但没有成功.
这是我用于iframe的代码,
<iframe src="http://www.facebook.com/sharer.php?u=http://www.website.com&t=Title Hoes Here"></iframe>
Run Code Online (Sandbox Code Playgroud)
当我查看页面时,它的空白和iframe源是
<iframe src="http://www.facebook.com/sharer.php?u=http://www.website.com&t=Title Hoes Here">
<html>
<body></body>
</html>
</iframe>
Run Code Online (Sandbox Code Playgroud)
如果我直接查看网址,一切都会正常显示.
facebook会阻止在iFrame中加载共享者吗?有什么替代方法让facebook分享者出现在模态窗口中?
谢谢
是的,Facebook几乎阻止了iFrames中所有屏幕的加载.
如果你正在使用Facebook连接,你可以执行一些简单的javascript方法来获得页面上的对话框,并且启动Facebook将注意使屏幕看起来很漂亮所需的大量工作.
请参阅此链接(http://developers.facebook.com/docs/reference/javascript/FB.ui/)或使用以下代码:
FB.ui(
{
method: 'feed',
name: 'Facebook Dialogs',
link: 'http://developers.facebook.com/docs/reference/dialogs/',
picture: 'http://fbrell.com/f8.jpg',
caption: 'Reference Documentation',
description: 'Dialogs provide a simple, consistent interface for applications to interface with users.'
},
function(response) {
if (response && response.post_id) {
alert('Post was published.');
} else {
alert('Post was not published.');
}
}
);
Run Code Online (Sandbox Code Playgroud)
如果你没有使用Facebook连接,那么你真正唯一可以获得确切屏幕的方法是弹出一个弹出窗口.
另一个选择是使用like/send按钮插件,这不是完全相同的功能,但更容易集成.http://developers.facebook.com/docs/plugins/
干杯!
| 归档时间: |
|
| 查看次数: |
18552 次 |
| 最近记录: |