Mateu Mateu -5 years ago 106
Javascript Question

Custom design for Twitter button with events

I've got a custom tweet button:

<a href=";text=myText;size=l&amp;count=none" target="_blank">
<img src="/assets/twitter-logo.jpg">

Now I want to achieve some result after the tweet has been published. To do so, I've looked at the Twitter Events API:

<script type="text/javascript" src=""></script>
<script type="text/javascript">'tweet', function (event) {
alert("Tweet Successful");

However, this API only works on non-custom buttons (

Anyone has managed to create a custom button which listens to events?

Answer Source

You can have a custom link and still have the web intents!

The key is, instead of your link pointing to "" it should point to ""

like this:

<a href="">Tweet</a>

This way you can use the web intents like you were trying:'tweet', function (event) {
  // Do something there

Check this jsFiddle

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download