This project is read-only.

Facebook style links (ajax preview)

Topics: Writing modules
May 23, 2011 at 1:12 AM

I want to allow my users to add to a list of urls.  I've created "link" content type. 

The type has: Url Field (hyperlink), and the following parts: body, comments, common, containable, starts, tweet button, tags, route and search. 

I'd like to ajax preview of the link like they do in facebook as store it in the body part.  Has anyone done anything like this?  I imagine they do an ajax request on key press.  If they get a valid response they parse it for an H1 tag and grab the first 200 chars of the body element. 

Any tips would be greatly appreciated.

May 23, 2011 at 10:26 AM

This is the kind of functionality I want to have in Media Garden ( At the moment you can enter a URL and the system figures out if it's a media file and to use a player, or for other files just to render a link. But I want additional processing of the file so if it's a web page, parsing it and reading title and body like you suggest. Unfortunately I don't know when I'll be able to work on that feature! (Although if you wanted to help implement it in Media Garden, I could certainly lend a hand)