我使用Facebook Share按钮。它可以正常使用此代码
<a href="https://www.facebook.com/sharer/sharer.php?u=www.sample.com" target="_blank">
Share on Facebook
</a></li>.
但此代码仅单独共享页面URL。但我需要共享该共享页面上存在的图像和电子邮件。这该怎么做 ?。任何人都可以帮助我吗?
答案 0 :(得分:0)
<a onclick="fb('www.google.com','abcd')" href="javascript:void(0);"><img src="<?php echo WEBSITE_IMG_URL; ?>fb.jpg" width="34" height="34" alt=""/></a>
(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/sdk.js#xfbml=1";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
function fb(url,title) {
var currentURL = encodeURIComponent(url);
window.open("https://www.facebook.com/sharer.php?u="+currentURL,"","height=368,width=600,left=100,top=100,menubar=0");
}