Test Center: Safari 4 preview

Apple's new beta of Safari for Mac OS X and Windows is fast, beautiful, tuned to the latest Web standards, and finally even with the remarkable WebKit project

You already know Safari. It's the only browser that ships with OS X, in the same manner that Internet Explorer is the de facto browser for Windows. Safari rose to greater recognition as the iPhone's touchy-feely Web 2.0 client. You might be aware that OS X and Windows editions of Safari are released in parity, function identically, and are updated automatically through Apple Software Update in response to security and stability issues.

You likely also know that Safari is implemented using WebKit, an open source framework for embedded HTML clients. It's at that point that the relationship between Safari and WebKit becomes hazy. The common belief is that Safari is effectively a front-end wrapper for WebKit.

[ Safari is ahead of the curve in speed, standards, and good looks, but not in security -- find out why in the Test Center guide to browser security. ]

I'll set that record straight. The default browser on all of my Macs is named WebKit.app. There is another program in the Applications folder named Safari.app. When I launch WebKit.app, the menu bar shows the name "Safari." WebKit is Safari, plus everything the independent WebKit project folds into its nightly builds. Those builds are released as source and as Windows and OS X executables that users are not warned away from, but encouraged to use.

Safari is WebKit frozen at a stable release, validated, supported (except for betas), and documented by Apple. That's essential added value given that WebKit joins Core Data, Core Animation, and other Apple frameworks that provide developers with one way, a right way, to incorporate any application feature. The safe, supported WebKit and its vastly accelerated JavaScript interpreter will move developers to shift more applications to the Web. Steve Jobs spoke of this at the iPhone announcement. He just spoke too soon.

Racing JavaScript
A key feature -- if not the key feature -- in Safari 4 beta, is the SquirrelFish/Nitro JavaScript interpreter. WebKit calls its boosted JavaScript SquirrelFish, not exactly glossy brochure material. Apple renamed it Nitro Engine. JavaScript is the "j" in "AJAX," so is responsible for first page draw latency. To do the fastest browser takes the fastest JavaScript, but also quick server communication.

Apple's "fastest browser" boast is proved by SunSpider JavaScript Benchmark tests against Firefox 3.0.5, both running on OS X Leopard 10.5.6. The SunSpider JavaScript Benchmark suite is freely available online, where you can test any browser you like. Note that the benchmark resides on WebKit's site. Mozilla and Microsoft should challenge the results if they feel their browsers are misrepresented.

In my runs of the SunSpider benchmark, Safari 4 beta skunked Firefox, which is the primary browser for POSIX platforms. (See the Lab Notes blog for my results.) With Apple's backing and a quick chain for distributing updates, Safari is a browser you need to have. You can download Safari 4 beta, and browse features and screen images, at Apple's Safari site.

Other features make Safari 4 flat irresistible. It's the first desktop release to support the local database features of HTML 5. The information and Web apps traditionally only available when you're linked to the network can be accessed locally. WebKit, nee Safari 4 beta, has a facility for examining and structuring tables and fields.

Field fill-in for URLs and keyword searches are attempted with each keystroke, for both the URL and search fields. The most likely matches show in a drop-down list populated by Google. URL matches are taken from Safari's history. The sites you visit most often can be displayed as a matrix of thumbnails when Safari 4 launches, and pages in your history can be leafed through in Cover Flow. When the RSS for a page is updated, an indicator lights up for that thumbnail.

I wish that these features were available to scan bookmarks as well. That's a facility that needs work overall.

The acid test
Safari/WebKit is the first browser to pass the Acid3 test for compatibility and completeness of a browser's implementation of CSS version 3. (These three screen images show the Acid3 reference rendering, the Safari 4 beta run, and the Firefox 3 run; a test run must produce a pixel-accurate duplicate of the reference rendering in order to pass.) Without that, we're stuck with the esoteric (but independent) Scalable Vector Graphics and the extremely resource-intensive (and proprietary) Flash. Leave it to slimmer, faster JavaScript. JavaScript tools are wanting in OS X. Thankfully, an integrated JavaScript console, debugger, and profiler have been added to WebKit. Although these leave much to be desired relative to native tools, they deliver more than print() can. The profiler is a particular standout.

A fast and pretty browser won't cut it for me. A browser -- and, indeed, any application that incorporates the linkable framework of that browser -- must place an equal emphasis on standards promotion and adoption, as well as accessibility. OS X's integrated Voice Assist and Universal Access preferences stand apart as mechanisms for inclusion for the visual and motor impaired. New to Safari 4 is support for ARIA (Accessible Rich Internet Applications), which takes screen reading and modalities for atypical navigation to the next level, to Web 2.0/AJAX Web apps and sites.

I'm relieved to see full-page zoom, a sort of experimental WebKit feature, included in Safari 4 beta. The typical text-only zoom command persists, but is augmented by a zoom that enlarges (or shrinks) the entire page, as a mobile browser would. Safari users can also create a non-defeatable style sheet and set a minimum font size. That anyone should be denied access to the Internet because of disabilities makes me see red. That the disabled can be held up for usurious sums for specialized devices that are no more capable than a MacBook is a message I struggle to get out. Apple leads in accessibility as a standard feature.

The Safari 4 beta is mighty fast, very possibly the world's fastest, and it's well in front in such cutting-edge standards as HTML 5, CSS 3, accelerated JavaScript, and ARIA. If you've a mind to, you can check out what the WebKit team is doing after the Safari 4 beta. WebKit is my favorite open source project by far, and arguably the best software decision that Apple has ever made.

Copyright © 2009 IDG Communications, Inc.