【发布时间】:2013-12-06 10:13:22
【问题描述】:
我正在尝试使用来自 FB 开发者页面的 HTML 和 JS SDK 源代码在网页中嵌入点赞/分享按钮,但在 Web 控制台中出现以下错误:
加载资源失败:在此服务器上找不到请求的 URL。 file://connect.facebook.net/en_US/all.js#xfbml=1
任何意见表示赞赏。
夏兰
要求的代码:
<!--LOAD FACEBOOK JSSDK FOR LIKE ETC-->
<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 = "http://connect.facebook.net/en_US/all.js#xfbml=1&appId=113830492072210";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
<!--FACEBOOK LIKE-->
<div class="fb-like" data-href="http://www.mooneycallans.com" data-send="false" data-layout="button_count" data-width="50" data-show-faces="false" data-colorscheme="dark" data-font="verdana"></div>
我使用的ID是从FB页面https://developers.facebook.com/docs/plugins/like-button/默认提供的。
也适用于 JS Fiddle: http://jsfiddle.net/
insertmg 前缀 http: 在 src URL 之前(现在为 http:file://connect.facebook.net/en_US/all.js#xfbml=1) 我仍然收到资源错误,并且:
Given URL is not allowed by the Application configuration.: One or more of the given URLs is not allowed by the App's settings. It must match the Website URL or Canvas URL, or the domain must be a subdomain of one of the App's domains
令人困惑...
【问题讨论】:
-
你能给我们看一些代码吗