This is a follow up to Speed up heavy Twitter feeds
The original post was quite simply a way for you to get yours or someone elses public Twitter timeline and display it on your own site. Twitter decided to kill off basic authentication for their API preventing simple Ajaxian requests to the API. So here is the solution and it comes in the form of JSONP (cross site scripting request).
So here is what I’m going to cover in this post for you optimisation fanatics, with code examples of the good, the bad and the ugly!
- Scope Management
- Data Access
- The DOM
Ever wondered where that missing second is in your blog or Web Sites loading time?
Chances are that it is getting eaten up by your feeds or third party API’s like Twitter, Facebook, Google andÂ Flickr. We all love social media, if you don’t then you were probably the school captain throughoutÂ your education and don’t posses the intrinsic ability to Tweet, Blog at update your feed from that shiny Iphone at any given time of the day, rain, hail or shine. But for the rest of us, here is a simple solution.
I personally enjoy including Twitter feeds for myself and clients on web sites, it highlights the human side of an at times, not so human interface. But it comes at a cost, around 700 – 800 milliseconds to be precise. So to include a Twitter feed on web-sites I build It would seem that we would have to sacrifice all the hard work done to optimise the web site so we can give it the cool edginess that a twitter feed presents. But what If we still want both! The answer is Ajax, pure and simple. Load your Twitter feeds via ajax onDomReady and insert them into your page when the server is finished fetching them from the Twitterplex.
How you say?