<li class="active">
<a id="shareFB" href="https://www.facebook.com/sharer/sharer.php?u=URLENCODED_URL&t=TITLE"
onclick="javascript:window.open(this.href, '', 'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=300,width=600');return false;" target="_blank" title="Share on Facebook">Facebook</a>
<script type="text/javascript">document.getElementById("shareFB").setAttribute("href", "https://www.facebook.com/sharer/sharer.php?u=" + document.URL);</script>
</li>
Are your using localHost. ? if you are using some plugins for share and you are in localHost then that's the issue. It will work fine when u deploy
In your url, you have 'https://www.facebook.com/sharer/sharer.php?u=...' . You should try replacing 'u' with 'href' in this url.
Try This...
function sethref()
{
document.getElementById("shareFB").setAttribute("href","https://www.facebook.com/sharer/sharer.php?u=" + encodeURIComponent(document.URL));
}
window.onload = sethref;
<!DOCTYPE html>
<html>
<title>Web Page Design</title>
<body>
<a id="shareFB">FB</a>
</body>
</html>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With