简体   繁体   English

我的Web应用程序上的“共享”按钮

[英]Share button on my web application

I want to add a button to share a picture. 我想添加一个按钮来共享图片。 This is my code in tag body: 这是我在标签正文中的代码:

<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 = "//connect.facebook.net/it_IT/sdk.js#xfbml=1&version=v2.0";
  fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>

<div class="fb-share-button" data-href="my_image"></div>

Don't work. 不要工作 When i run my page.html it show an error: 当我运行我的page.html时,显示错误:

GET file://connect.facebook.net/it_IT/sdk.js net::ERR_FILE_NOT_FOUND GET file://connect.facebook.net/it_IT/sdk.js net :: ERR_FILE_NOT_FOUND

However I WANT TO SHARE WITHOUT ID_APP! 但是我想不带ID_APP分享!

Since you're testing this locally using a file path, "file:" is prepended onto the URL for the facebook script, hence the "file://connect.facebook.net". 由于您是使用文件路径在本地进行测试的,因此“ file:”位于Facebook脚本的URL前面,因此为“ file://connect.facebook.net”。 If you change the url to use "http:" or "https:" in the script, it should work as desired. 如果您在脚本中将URL更改为使用“ http:”或“ https:”,则该URL应该可以正常工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM