Get the Official Twitter Share Bookmarklet

Get the Official Twitter Share Bookmarklet

We love twitter. The mini-blogging site is a great place for everyone to stay in touch with the happenings in the world that we want to know about. This no nonsense approach saves time, space and money. The Twitter Share Bookmarklet allows you to share a webpage directly over Twitter.

Official Twitter Share Bookmarklet image
Twitter Share Bookmarklet – Just click on the bookmarklet and it will allow to share the link directly in twitter.

The code for the Official Twitter Share Bookmarklet is provided on their website here. But you can certainly change the way to some extent. The look and feel you can try changing by modifying the values as shown below.

javascript:(function(){window.twttr=window.twttr||{};var D=550,A=450,C=screen.height,B=screen.width,H=Math.round((B/2)-(D/2)),G=0,F=document,E;if(C>A){G=Math.round((C/2)-(A/2))}'

Now you can change the values of A, B, C, D to get the desired look and feel you want in this Twitter Share Bookmarklet code. For example you can give hard-coded values to C and B. Though I would not recommend it. It is safe to play around with the values of A and D. 

You may not like linking to yet another external JavaScript file for this to work. You can easily navigate to this script and create a copy of it in your own server. This will reduce the number of lookups for external domains. Of course, this is going to be a minor improvement only as most of the time, these files stay cached. But any improvement is good. The only downside will be any modification of the original script at twitter won’t be automatically seen in your site. But you can argue that it is a small price to pay.

The modified code for the twitter share bookmarklet may look something like this.

javascript:(function(){window.twttr=window.twttr||{};var D=550,A=450,C=screen.height,B=screen.width,H=Math.round((B/2)-(D/2)),G=0,F=document,E;if(C&gt;A){G=Math.round((C/2)-(A/2))}'','','left='+H+',top='+G+',width='+D+',height='+A+',personalbar=0,toolbar=0,scrollbars=1,resizable=1');E=F.createElement('script');E.src='<yoursite>/share.js?v=1';F.getElementsByTagName('head')[0].appendChild(E)}());

You can follow the instruction over at their site to get it done. Otherwise you can get it here. Otherwise you can open up your bookmark manager, create a new bookmark and in the link section add the code manually. Good luck!

By Sarthak Ganguly

A programming aficionado, Sarthak spends most of his time programming or computing. He has been programming since his sixth grade. Now he has two websites in his name and is busy writing two books. Apart from programming, he likes reading books, hanging out with friends, watching movies and planning wartime strategies.

Leave a Reply

Your email address will not be published. Required fields are marked *