What’s DHTML Compilation Good For?

OpenLaszlo allows you to compile applications to SWF8, SWF9 or DHTML. Recently I’ve heard people ask, “why would you want to compile an application to DHTML?”

When you think about it, that’s not a silly question at all. Regardless of whether you compile an OpenLaszlo application to SWF or DHTML, you’ll have similar benefits and simliar constraints. On the positive side, coding complex and interactive user interfaces is straightforward. You’re using a language that was specificially designed for rich Internet applications (RIAs).

However, many of the problems people associate with SWF – inability to bookmark (what exactly?), lack of search engine exposure, back button integration (you want to try explaining what’s supposed to happen when you click back in a RIA), difficulty of integration with traditional HTML applications – affect DHTML-compiled OpenLaszlo applications too. Thankfully these days, most developers understand that a platform like OpenLaszlo isn’t supposed to replace HTML applications, but instead is intended for a specific type of application that’s difficult, if not impossible, to do with HTML. Think Gliffy.

So if DHTML doesn’t solve some of most long-standing “problems” of Flash, what does it offer? Certainly not media support; in fact SWF-compiled OpenLaszlo applications have more consistent support for PNG, as well as FLV, SWF, MP3.

Surely DHTML-compiled OpenLaszlo applications must offer some other benefits then? Well, they work in Webkit, which means they’ll run on the iPhone (and of course many upcoming mobile devices that use DHTML). That’s definitely an advantage, but the applications are still limited by the performance of the small CPU.

So now we get to where DHTML compilation really shines… Remember how I said that OpenLaszlo was good for some applications, and HTML was good for others? DHTML-compilation in OpenLaszlo allows you to run one or more HTML applications inside your OpenLaszlo application!

How can it do this? By using the <html> tag, you can embed another web property (e.g. a web site, HTML-based application) inside your OpenLaszlo application. Here’s an example that shows two HTML web sites embedded in the same OpenLaszlo application:

Screenshot of two HTML applications in one OpenLaszlo application
Screenshot of two HTML applications in one OpenLaszlo application

Unfortunately, I can’t simply embed this example into my blog, because it relies on the OpenLaszlo wrapper code. You have to click the screenshot above and then play with the windows.

You may be aware that SWF-compilation also supports the <html> tag. However, the problem with using the <html> tag with a SWF-compiled OpenLaszlo application is that the IFRAME which displays the HTML web site will always float above the SWF. That means you can’t really have a windowed application, unless you’re satisfied with only having one window in your entire application. And you can’t have two <html> tags, if they’re likely to ever overlap, since there’s no way to control which is on top at any one point.

As you can see, that’s not a problem for DHTML.

Download the source for this example.

4 thoughts on “What’s DHTML Compilation Good For?

  1. I still believe that you need more in the DHTML runtime to turn into a full advantage for OpenLaszlo. It adds a lot of extra work compared to Flex applications as well: every Flash/AS2+3 based component has to be encapsulated by extra code, and we can see from the video components that it’s not easy to maintain the components across versions and even minor releases.

    Adding support for open video and downloadable fonts across runtimes (for Safari4 and Firefox 3.5) would be good use case to show the power of OpenLaszlo. But unfortunately I don’t see anyone pushing for features like that and a good case study right now.

    Another question is: where is the large number of Flash/DHTML applications deployed? I don’t know a single Gliffy-like application deployed for both runtimes. The DHTML runtime has been around for more than 2 years know, and we still need to see a proof that it’s working in production on an enterprise level.

  2. that is cool. DHTML can be a useful tool in the whole RIA experience and the mobile advantage is high on the list of needed features.

Leave a Reply to Raju Bitter Cancel reply

Your email address will not be published. Required fields are marked *