Question

I recently develop a shortener URL script, now I'm trying to add Addthis buttons but the problem is that is sharing the current URL of the site is on. I want the Addthis buttons share the URL that is inside of the URL Input field anybody got some idea on how to do it?

Basically I want to add Addthis buttons and share the URL from a Input field that got the URL shorted .

Was it helpful?

Solution

The Real Question: How can you specify a custom URL for Addthis?

jQuery Solution

HTML

<a href="http://www.addthis.com/bookmark.php" class="addthis_button" id="youmusthaveanid">

jQuery

$('#youridhere').attr('addthis:url', $('#yourinput').val);

Note: Remember you will have to trigger this on every update of the text box if it's content changes after the Javascript has been run on initial load. PHP Solution

HTML/PHP

<a href="http://www.addthis.com/bookmark.php" class="addthis_button" addthis:url="<?=$yourvariablehere?>"

Source: Addthis API Docs

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top