It also did not work on Opera.
I decided to jump into twitter's API and figure out if I could get this to work on my own. I didn't bother with making it customisable, but if you want to reuse it, you'll need to change my username to your own. Here's what I did.
First, create a div that will hold my timeline:
<div id="twitter"> <ul class="twitter-timeline"> </ul> <div class="follow-me"><a href="http://twitter.com/bluesmoon">Follow me on twitter</a></div> </div>Put this wherever you want your timeline to go.
Next, write the Javascript that will draw the timeline. This is fairly simple:
function show_twitter(o) { var div = document.getElementById("twitter"); var ul = div.getElementsByTagName("ul")[0]; ul.innerHTML = ""; for(var i=0; i<o.length; i++) { var li = document.createElement("li"); li.innerHTML = o[i].text.replace(/@(\w+)/, "<a href='http://twitter.com/$1'>@$1</a>"); ul.appendChild(li); } }I put this at the start of the document, but you can put it anywhere before you make a call to the twitter API, which is the next step:
<script src='http://twitter.com/statuses/user_timeline.json?id=bluesmoon&count=5&callback=show_twitter' type='text/javascript'></script>A few things to note about this call:
- It's got my userid in it. It only works with userids that have public timelines
- count is limited to 5 items
- the callback parameter's value is the name of the function we defined in the previous step.
Short URL: http://tr.im/bloggertwitter