27
Jul
09

Twitter bookmarklet

The previous version of my bookmarklet, only works when you’re on the Twitter website due to AJAX domain restrictions….

javascript:req=new XMLHttpRequest();req.open("POST","http://twitter.com/statuses/update.xml",true);req.setRequestHeader("Content-type","application/x-www-form-urlencoded");req.setRequestHeader("Authorization","Basic <base64 encode username:password here>");req.send("status="+window.getSelection());

But don’t be afraid, here is the new version!

javascript:req=document.createElement("form");req.method="POST";req.action="http://twitter.com/statuses/update.rss";tweet=document.createElement("input");tweet.name="status";tweet.value=window.getSelection();req.appendChild(tweet);document.body.appendChild(req);req.submit();

It’s less beautiful, but it works better and the configuration is easier. First go to the Twitter API page. Your browser will prompt you for your username and password, and likely an option to remember it. Click this option as my bookmarklet is unable to provide authentication. Next add this code to you bookmarks(WordPress won’t let me place it in a link for you). The only downside to this version is that it submits a form to the API page. This might also work on Internet Explorer!

Advertisements


My blog has moved!

My blog has permanently moved to a self hosted Wordpress at http://pepijndevos.nl

This blog will stay around for accidental search engine visitors.

Me

This is me

Blog Stats

  • 22,233 hits

@PepijnDeVos


%d bloggers like this: