Wednesday, June 29, 2011

Adding Twitter follow button to a web page

There are three ways you can add the Tweet Button to your webpage.
Using javascript

The easiest way to add the Tweet Button to your website is to use javascript. This method requires adding a line of javascript and an HTML anchor to your webpage. Using this method you can customise the Tweet Button using data attributes and query string parameters.

Notice how the anchor element has a class of twitter-share-button. This is required for the Tweet Button javascript to know which anchor elements to convert to buttons.




Using an iframe

If you prefer you can add a Tweet Button using an iframe. When using this method you have to use query string parameters to customise the Tweet Button’s behavior.



Build your own

If you want to be able to customise the way the Tweet Button looks you will want to use this basic format. When using this method you have to use query string parameters to customise the Tweet Button’s behavior as well as handle the popup of the Share Box.

The dimensions of the Share Box are listed in our Tweet Button FAQ.

Tweet

Properties

There are several properties for the Tweet Button which allow you to customise its behavior. Whilst the Tweet Button will work without any of this properties, using them allows you to provide default values for the user to Tweet. If the query string, data source or link source are not provided the Tweet Button will use the default values available from the web page and referrer information.

To learn more about each property and to see ways you can use them check the examples further down this page.
Properties which can be used by all types of Tweet Button

The properties in this table can be used by the javascript, iframe and build your own Tweet Buttons. Each property is a query string parameter for the http://twitter.com/share URL.
Query String Parameter Description
url URL of the page to share
via Screen name of the user to attribute the Tweet to
text Default Tweet text
related Related accounts
count Count box position
lang The language for the Tweet Button
counturl The URL to which your shared URL resolves to


With Regards,
Er.Animesh Nanda
Software Developer,
Manusis Technology Pvt. Ltd.
Bengaluru,Karnataka,INDIA.

No comments:

Post a Comment