Tag Archives: tweet

Faster And Fault-Proof Tweet Button

30 Aug

" alt="Faster And Fault-Proof Tweet Button" width="490" height="200" class="thumbnail" />

At WRD, the previous tweet button for sharing stories was the cool Easy Retweet Button by John Resig. However, it was not perfect as, sometimes, it was unable to communicate with the URL shortener service and the tweet links were appearing buggy.

In search for a better one, I tested few others including the official tweet button. They were loading the links ok but had other issues like “loading slow”, “blocking pages on load”, etc.

And, for a button that is clicked by -maybe- 1/100 of the visitors, loading the scripts and making requests for every visitor didn't look like the smartest choice.

Here is another method, that is actually used at WRD now which loads very fast for everyone and almost fault-proof.

Faster Tweet Button

Demo Faster Tweet Button
Download Faster Tweet Button

How it works?

First of all, the button is hosted locally and it does not make any requests until it is clicked.

  • A link with the querystring that includes URL and the title of the web page is created, pointed to a server-side file (to be presented later in this article) and attached to any custom button we design.
  • Once clicked, it sends the URL and title to the server-side file which creates the tweet link and redirects to Twitter with the tweet.

Pros

  • Does not load any scripts from other domains (faster).
  • Does not perform anything until being clicked (faster).
  • Works with multiple URL shortener services. Currently, it uses Bit.ly by default, during the shortening, if there is an error, it falls back to Tinyurl. And if there is an error again, it uses the default URL. (fault-proof).
  • Counts the number of characters used and, if more than 140, reformats it. (fault-proof).
  • Any tweet button that you design can be used or just a “tweet it ” text is enough (styleable).

Cons

  • Does not display the number of retweets (as no requests are made on load).

The Code

It is built by PHP. You'll see that the code is simple and can be ported to any other scripting language quickly. Here it is:

 140) {
	$tweet = urlencode(substr($postTitle,0,140 - $restLength - $dotsMargin)) . urlencode('.. - ') . $shortenedURL . $viaText;
}
/* Prepare Tweet - END */

/* Redirect To Twitter - START */
header('Location: http://twitter.com/home?status=' . $tweet);
/* Redirect To Twitter - END */
?>

The Button

It is possible to use a button you designed. At WRD, the “Official Tweet Button” images are used thinking that they will be the standard soon. If you prefer to use it too, here is the HTML-CSS for it:




    




	


How To Install?

Here are the steps:

Any thoughts to make it better?

Special Downloads:
Ajaxed Add-To-Basket Scenarios With jQuery And PHP
Free Admin Template For Web Applications
jQuery Dynamic Drag’n Drop
ScheduledTweets

Advertisements:
Professional XHTML Admin Template ($15 Discount With The Code: WRD.)
Psd to Xhtml
SSLmatic – Cheap SSL Certificates (from $19.99/year)

Tags: ,

Related posts

 

Click here to read the full article

Article Source: Faster And Fault-Proof Tweet Button

Christian Design Free Wordpress Theme

15 Dec

Matinik Red is a featured-packed and multi-colored free WordPress theme with TweetMeme retweet button. It has 2 columns, with an easy Options page for customization

 

Click here to read the full article

Article Source: Christian Design Free Wordpress Theme

There are separate styles and genres of melody and some of them …

14 Dec

Matinik Red is a featured-packed and multi-colored free WordPress theme with TweetMeme retweet button.

 

Click here to read the full article

Article Source: There are separate styles and genres of melody and some of them …

Christian Emporium Free Wordpress Theme

14 Dec

Matinik Red is a featured-packed and multi-colored free WordPress theme with TweetMeme retweet button. It has 2 columns, with an easy Options page for customization. Load.

 

Click here to read the full article

Article Source: Christian Emporium Free Wordpress Theme

Free WordPress Theme – My Menu. Free Download

14 Dec

Matinik Red is a featured-packed and multi-colored free WordPress theme with TweetMeme retweet button.

 

Click here to read the full article

Article Source: Free WordPress Theme – My Menu. Free Download

Free WordPress Theme – My Menu. Free Download

14 Dec

Matinik Red is a featured-packed and multi-colored free WordPress theme with TweetMeme retweet button. It has 2 columns, with an easy Options page for customization. Load

 

Click here to read the full article

Article Source: Free WordPress Theme – My Menu. Free Download

Blue Secret

13 Dec

Marikit Blue is a featured-packed and multi-colored free WordPress theme with TweetMeme retweet button. It has 3 columns, with an easy Options page for customization

 

Click here to read the full article

Article Source: Blue Secret

Inksplash

13 Dec

Matinik Red is a featured-packed and multi-colored free WordPress theme with TweetMeme retweet button.

 

Click here to read the full article

Article Source: Inksplash

Drummer

13 Dec

Matinik Red is a featured-packed and multi-colored free WordPress theme with TweetMeme retweet button. It has 2 columns, with an easy Options page for customization.

 

Click here to read the full article

Article Source: Drummer

blu-poker

12 Dec

Matinik Red is a featured-packed and multi-colored free WordPress theme with TweetMeme retweet button.

 

Click here to read the full article

Article Source: blu-poker