views:

108

answers:

1

Hi.. I wanted to implement a "live preview" of forum posts / comments / etc, kinda like stackoverflow.com does (when you ask a question, you see the preview below it in the div with the blue background).

What's the best way to do it? I would really want to avoid re-implementing my bbcode parser in java as it would be very complex. I was thinking about ajax, but isn't reparsing the entire message every time a user presses a keystroke VERY cpu intensive?

How does stackoverflow do it? I tried to look at the html / etc but couldn't find the code :/

+3  A: 

The "live preview" is part of the WDM editor used on stackoverflow. It is almost certainly implemented in java script, but I'm not really intimately familiar with how its done to go into any detail beyond that.

shsteimer
wow that's great. thanks.
Andreas Bonini
It's not AJAX - you can tell by using Firebug, which shows AJAX requests in the console. The POST and refresh are done via AJAX, but not the live preview.
Daniel Roseman