简体   繁体   English

如何在ASP.NET中使用Java脚本在Facebook上共享图像

[英]How to share images on facebook using java script in asp.net

I am using facebook share button functionality but it sharing page urls but i want to share images from my code to facebook 我正在使用Facebook分享按钮功能,但它分享页面网址,但我想将我的代码中的图片分享到Facebook

Here is the code 这是代码

<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/en_US/all.js#xfbml=1";
  fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));

 </script>

<div class="fb-share-button" data-href="http://developers.facebook.com/docs/plugins/"
data-type="button">
</div>

In the above given div tag data-href i wanna pass my image urls dynamically plz help me 在上面给定的div标签data-href中,我想动态传递我的图片网址,请帮助

you can do somthing like this 你可以做这样的事情

Paste this code in your section: Please see the image to check code http://oi62.tinypic.com/qyai4m.jpg 将此代码粘贴到您的部分中:请查看图片以检查代码http://oi62.tinypic.com/qyai4m.jpg

this will replace facebook url with your website's current url which you want to share on facebook. 这会将Facebook网址替换为您要在Facebook上共享的网站当前网址。

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

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