Thursday, 21 June 2012

Render twitter embedded tweet (web intents style) dynamically

Just a quick one, a note about the Twitter oEmbed API. If you use Javascript to load in this content and insert it in to the page,instead of doing as they ask and caching it, though you could still insert a newly found web intents widget and cache it at the same time, the tweet will be the basic HTML that is returned via the API call to Twitter's oEmbed service.

In your callback, where you're adding the HTML to the page that has been returned by the oEmbed API, make sure you put the following in to "kick start" your code's styling, ensuring the embedded tweet is styled up as a web intents widget and not just a blockquote:

twttr.widgets.load();

Simple!