How do I create a link that takes the static part of a ‘sharing’ link (of a social media site like LinkedIn) and appends the url of the current page? So that a user can share the page’s URL on their social media account.
I do not want to use Share This or any other such widgets.
Thanks
EDIT
So of the solutions suggested I opted for the jQuery one. After a lot of help, this was the solution:
HTML
<a class="linkedin" href="#">LinkedIn</a>
jQuery
$(document).ready(function() {
$('a.linkedin').click(function() {
var link = document.location;
var url = "https://www.linkedin.com/shareArticle?mini=true&url=" + link;
document.location.href = url;
});
});
Obviously, it can work for any social media site that allows such URLs.
If you do not mind using jQuery