I want to share a particular link when clicked on a share button in my app. Facebook share button snipet
<a href="#"
onclick="
window.open(
'https://www.facebook.com/sharer/sharer.php?u='+encodeURIComponent(location.href),
'facebook-share-dialog',
'width=626,height=436');
return false;">
Share on Facebook
</a>
How do i input my custom url?
Change location.href
to whatever URL you want to share.
For example:
<a href="#"
onclick="
window.open(
'https://www.facebook.com/sharer/sharer.php?u='+encodeURIComponent('http://google.com'),
'facebook-share-dialog',
'width=626,height=436');
return false;">
Share on Facebook
</a>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.