Computerworld

First look: Firefox 4 Beta 1 shines on HTML5

Sure, Firefox 4's new Chrome-like UI is nice, but the real story is under the hood

While it's impossible to sum up the thousands of enhancements and bug fixes both big and small, the Firefox 4 beta version brings the browser that much closer to taking over everything on the desktop. There are fewer reasons for anyone to interact with an extra plug-in or the operating system. Remember when people cared about whether a machine was Windows or Mac or a Commodore 64? Remember when software needed to be written in native code? Those days are fading away quickly as the browser is more able than ever before to deliver most of the content we might want.

You've no doubt heard about or even seen Firefox 4's new Chrome-like interface. More important are the many new features generally lumped together under the catchall standard HTML5, a specification that's still a draft but has become more of a rallying cry for AJAX, JavaScript, endless tags, and life beyond plug-ins.

[ Also on InfoWorld: HTML5 will spawn richer, more sophisticated websites while also easing development. Read about the nine ways HTML5's impact will be felt in "How HTML5 will change the Web." ]

Many of the enticing new features open up new opportunities for AJAX and JavaScript programmers to add more razzle-dazzle and catch up with Adobe Flash, Adobe AIR, Microsoft Silverlight, and other plug-ins. The CSS transitions, still "partially supported" in Firefox 4 Beta 1, give programmers the chance to set up one model for changing the CSS parameters without writing a separate JavaScript function to do it. The browser just fades and tweaks the CSS parameters over time.

There are plenty of other little parts of HTML5 that have been slowly arriving in previous versions of Firefox but are now being more fully integerated. MathML and SVG data are now a bit easier to mix right in with old-fashioned text. The Canvas and optional WebGL layers can create custom images at the browser without waiting for a server to deliver a GIF. A handful of new tags like <header> and <figure> offer a more document-centric approach, so the browser can present information more like the data on the printed page. The <figure> tag can be matched with a <figcaption> tag and the browser will keep the two together and try to put the results near the <mark> tag.

These are just some of the options that programmers can use to add more zip to static text. Firefox 4 also adds an implementation of the Websockets API, a tool for enabling the browser and the server to pass data back and forth as needed, making it unnecessary for the browser to keep asking the server if there's anything new to report. If there's a need to store some of this data locally, the JavaScript programmer now gets access to indexed databases. They're not exactly flat files, but they're useful if you want to store and index name/value pairs data.

Converting this information to the HTML tags is becoming more fluid. The Mozilla release notes, for instance, brag that Firefox 4's parser is 20 percent faster at interpreting the innerHTML calls generated by dynamic JavaScript. The frames are supposedly going to be evaluated in a lazy manner so that the page resembles its final form a bit sooner. And now plug-ins are running in separate threads, offering so-called Crash Protection against glitches.

Some of this is clearly paying off. Firefox 4 Beta 1 scored 3,573 on the Peacekeeper benchmark, much better than 2,470, the score produced by Firefox 3.6.4 on the same machine. These values, though, still lag behind the competition. Other browsers, including Chrome, Opera, and Safari, score between 5,000 and 7,000. There is a similar gap in the JavaScript-centric SunSpider benchmarks: 970ms for Firefox 4 Beta 1 versus 750ms for Chrome.

Are these differences notable during normal browsing? Not really. I felt like the latency of the Internet was the real bottleneck, not whether some complicated JavaScript loop was finishing 10 percent faster; after all, I don't see many complicated loops on the Web pages I visit. Most JavaScript does little more than dutifully fetch information and render it. The amount of memory in the computer is probably a bigger killjoy than the measured speed. Version 4.0 is just a beta, of course, and the best JavaScript engine still isn't included yet. Mozilla's release notes say that a better JIT (Just In Time) compiler for JavaScript and layered rendering engine are "coming soon."

There are areas in which Firefox still leads. Firefox's collection of extensions and plug-ins is still broader and more developed than any other. Firefox 4 nurtures this advantage by making it possible to turn the different extensions on and off without restarting. Firefox is also taking the lead by implementing Google's WebM video standard, a wise decision given that Firefox is largely supported by ad revenue from the Google search box. Chrome's own support for WebM is found through the early release version, but that should change soon.

Many people may come away from this beta feeling that Firefox is still catching up with the other browsers. The speed doesn't leapfrog the competition. The tabs are now arranged across the top of the window more like Chrome. Some of the buttons feel just like Opera's versions. It's clearly a competitive market these days, and the best innovations are quickly copied. The browser programmers are taking the best from each other, and this is competition at its finest.

Related articles

How HTML5 will change the WebHTML5 will spawn richer, more sophisticated Websites while also easing development. Here are nine ways the impact of HTML5 will be feltWhat to expect from HTML5Support for the next generation of HTML is already appearing in today's browsers and Web pages. Are you ready to take advantage?HTML5 vs. Flash: The case for FlashSeven reasons Web designers will remain loyal to Flash for rich Web contentApple vs. Flash: The InfoWorld peace planWars like the conflict between Apple and Adobe over Flash seldom yield a productive outcome. InfoWorld proposes a way forwardStop bashing FlashWhen Steve Jobs and Microsoft's point man for IE agree, you have a right to be skepticalLights out for Flash and its RIA brethrenApple's ban on Flash for the iPhone is another nail in the coffin for proprietary RIA platforms -- and good riddanceInfoWorld review: Flash Builder 4 lights up rich Internet app developmentFlash Builder 4 delivers time-saving tools that speed data delivery for Flex apps, streamlines testing and workflow for Flash and AIRInfoWorld review: Eight PHP power toolsEclipse PDT, NetBeans, NuSphere PhpED, and Zend Studio lead a capable field of IDEs for Web developers

This story, "First look: Firefox 4 Beta 1 shines on HTML5," was originally published at InfoWorld.com. Follow the latest news in software development, languages and standards, HTML, and applications at InfoWorld.com.

Read more about applications in InfoWorld's Applications Channel.