Custom tweet button with javascript

I was following the topic Build Your Own Tweet Button on

They explicitly say

JavaScript Interfaces for Twitter are not available for custom Tweet Buttons.

But we can have a custom tweet button (or link) and still have the Twitter javascript  API (web intents).

All you have to do is to include the javascript file for the Twitter API:

<script src=""></script>

Your custom button (link in this example):

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

This is the trick, instead of the link pointing to

your link should point to

This way you still be able to use Twitter API. The following code shows how you can get

the tweet event:'tweet', function (event) {
  // Do something there

Check the online demo