2013-11-21 36 views
0

我tryimg嵌入使用来自FB开发者页面的HTML和JS SDK源的网页中的Like/Share按钮,但在Web控制台中出现以下错误中的错误:资源错误嵌入FB像按钮

加载资源失败:在此服务器上找不到请求的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是从https://developers.facebook.com/docs/plugins/like-button/的FB页面提供的缺省。

也适用于JS小提琴: http://jsfiddle.net/

后insertmg prefox HTTP: 的src网址(::文件//connect.facebook.net/en_US/all.js#xfbml=1现在HTTP)前我仍然得到respurce错误:

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 

混乱...

+0

你能告诉我们一些代码吗 –

回答

1

问题是我在本地主机上测试时,Facebook JS正在尝试引用网站。 通过将HTML文件与脚本保存到服务器并从那里运行它很好。

似乎是一个经常遇到的问题。

Ta为输入。

0

错误意味着像/共享按钮找不到。检查你的链接是否有任何错误,并检查服务器上是否仍然存在该按钮