无法让 Facebook 之类的框代码在我的网站上运行
这是正在生成的代码。
<div id="fb-root"></div><script>(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#xfbml=1";d.getElementsByTagName('head')[0].appendChild(js);}(document));</script><div class="fb-like-box" datahref="http://www.facebook.com/pages/Taylor-Made-Services/177805802285173" data-width="292" data-show-faces="false" data-stream="false" data-header="false"></div>
我花了 4 个小时试图让它工作,但我放弃了。
This is the code being generated.
<div id="fb-root"></div><script>(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#xfbml=1";d.getElementsByTagName('head')[0].appendChild(js);}(document));</script><div class="fb-like-box" datahref="http://www.facebook.com/pages/Taylor-Made-Services/177805802285173" data-width="292" data-show-faces="false" data-stream="false" data-header="false"></div>
I've been trying to get it to work for 4 hours, and I give up.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
也许这是一个复制粘贴错误,但我怀疑 datahref 应该是 data-href。
Maybe it is a copy-paste error, but I suspect that datahref should be data-href.
您的页面上是否使用了任何开放图谱标签?要让 Facebook 之类的按钮与 FBML 配合使用,需要一些标签。否则,您也许可以使用 iframe 版本并使其正常工作。或者尝试通过 AddThis 之类的东西使用“喜欢”按钮,它不需要打开图形标签即可工作,因为他们处理脚本。
Are you using any Open Graph tags on your pages? There are some required tags to get Facebook like buttons to work with FBML. Otherwise you may be able to use the iframe version and get it to work. Or maybe try using the like button through something like AddThis which doesn't require open graph tags for it to work because they handle the scripting.
将 //connect.facebook.net 更改为 http://connect.facebook.net
change //connect.facebook.net to http://connect.facebook.net