[英]Specify url in facebook share button sharer.php
I am trying to set a share button in my dynamically created webpage. 我正在尝试在动态创建的网页中设置共享按钮。 I am using this code: 我正在使用此代码:
<a name="fb_share" type="button_count" share_url="TEXT" href="http://www.facebook.com/sharer.php?u="URL">Share</a>
But all I get is the original url plus my text "TEXT". 但是,我得到的只是原始网址以及我的文本“ TEXT”。 I can't use the original url since it will not exists. 我无法使用原始网址,因为它不存在。 It is just created for that moment every time. 每次都是为此而创建的。 So I want to share a fixed url. 所以我想分享一个固定的网址。
Is it possible? 可能吗? I haven't had any problem with google plus or twitter. 我在Google Plus或Twitter上没有任何问题。
That code is deprecated. 该代码已弃用。
If you want to share a URL different from the current one, that is not posible anymore. 如果要共享与当前URL不同的URL,则不再可行。
You can get more info and current code in https://developers.facebook.com/docs/plugins/share-button/ 您可以在https://developers.facebook.com/docs/plugins/share-button/中获取更多信息和当前代码。
Exactly, right after the 恰好在
<body>
you should add 您应该添加
<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/es_ES/all.js#xfbml=1";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
</script>
Adn then you have to add wherever you like the following: 然后,您必须在需要的地方添加以下内容:
<div class="fb-share-button" data-href="http://developers.facebook.com/docs/plugins/" data-type="button_count">
</div>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.