I have recently been playing with John Resig’s Twitter Quick Reply bookmark, and decided to make a little helpful plugin of my own. Playing around with the javascript from his bookmark and the UrlKiss bookmark, I came up with TwitterThis.
To use TwitterThis simply drag this link TwitterThis to your bookmarks toolbar. Now whenever you are on a site that you would like to link to from twitter, just click the bookmark in your bookmarks bar and you will be taken to twitter and the url address of that page will be inserted into update area.
The Code
javascript:void(location.href='http://twitter.com/home?status='+escape(location.href))
update July 24, 2008
Gabe Jamison remodeled the script a little bit so that it will open up in a new window instead of opening in the same window. TwitterThisInAnotherWindowBesidesTheOneYouAreIn
javascript:void(window.open('http://twitter.com/home?status='+escape(location.href)))
The Reason
I know it’s not particularly hard to copy, go to twitter, and paste but this will save you a few clicks. So enjoy!
- Categorys:
- Sites
- javascript
Here is what I changed to open a new window. Yeah, it’s a simple change, but I like opening a new window. That way I don’t have to use the back button to return to the article/page.
javascript:void(window.open('http://twitter.com/home?status='+escape(location.href)))Downside to this one is that you cannot right-click or command-click, otherwise you get an “about:blank” returned to the status box.
I went ahead and made the update with the code Gabe presented. Although I still recommend my code. The reason being is that if you want to open in a new tab, it will work well in Firefox. In Safari and I presume IE an entire new browser window will be opened. Personally, I would rather have it change my current window than open a new one.
I agree with Dylan. I never like websites to open new windows or tabs for me. If I decide I want something to be opened in a new tab, I will command click (or whatever) and open it myself.
But thats the great thing about “open source”. Gabe can modify it to suit his needs.
[...] while ago I wrote a simple javascript bookmarklet for posting a link to twitter without having to copy and paste. With the introduction to zappme, a [...]