Just after the announcement of the new iPhone 4 at WWDC, Apple announced the release of Safari 5 for Windows and Mac. Unlike Safari 4—which focused primarily on cosmetic improvements like the Top Sites page and the ill-fated top tabs—this release brings a big focus on standards compatibility, speed improvements, a new Apple-vetted extensions system, the ability to switch between Google, Yahoo, and Bing for default search, and a new feature that Apple calls Safari Reader.

Apple’s new Nitro JavaScript Engine runs JavaScript up to 30 percent faster than Safari 4. We’ve covered the Nitro engine in the past, which was originally called the less marketable name of SquirrelFish Extreme. Nitro, or some variant of it, is currently suspected to be in use in Mobile Safari.

Apple now uses DNS prefetching to speed up page loads; Google’s Chrome browser has incorporated this optimization for a while now. On complex sites, there can be tens to hundreds of different resources located on different web domains (like arstechnica.com, cdn.arstechnica.net and so on). Everytime you load a page, a request needs to be made to your DNS servers to get those site’s IP address. There is, of course, network latency inherent in every one of those requests, and they can add up.

What Safari 5 will do now is look ahead to links you might click and begin pre-resolving those domains' IPs. When you do eventually click on one of those links, the browser will have already figured out the IP addresses it needs and can begin grabbing the data. Apple has also improved how previously visited pages are cached, claiming that return visits to those pages will see improved loading times.

Reader and HTML5

Apple bills Safari's new Reader feature as a way to read articles on the web in a “ new, scrollable view without any additional content or clutter.” This shows shades of a very popular online bookmarklet called Readability, developed by Arc90, as opposed to an Instapaper-like service, which uploads the content of an article to a third-party server for reading on different devices at a later date. Safari 5 contains heuristics that will detect if a webpage contains an article and it will present a "Reader button" in the Smart Address field. Clicking that button will remove all webpage content, ads and all, and leave only the meat of the article. From that point there will be options to enlarge the text, print the article, or email the contents.

Another interesting tidbit is that Safari Reader will stitch together multipage articles in this same manner, much to some sites' chagrin. What's cool about Apple's implementation is that once a user clicks the "Reader" button, Safari begins downloading every page of an article in the background and begins stitching them together. It does a full, real, request on every single page. The publication sees all the pageviews on every page and even ad frames get downloaded for each pageview, which could quell some publisher worries.

Safari 5's Reader feature use on a multi-page Ars article.

Another huge part of Safari 5 is the mainstream availably of a large number of HTML5 features. Previously, many of these features have been available on nightly builds of Webkit—which are essentially Safari 4 wrapped around cutting-edge builds of Apple’s web rendering engine. With the release of Safari 5, Apple is rolling out support for full-screen video and closed-captioning on HTML5 video, Geolocation, sectioning elements, draggable attribute, forms validation, Ruby, AJAX History, EventSource, and WebSockets. I should just pause here and tell you that as a web developer, this previous paragraph made me giddy with delight. A number of these APIs and abilities are available here and there in Chrome and Firefox and they’ve been sorely missing from Safari.

Secure extensions

Probably one of the least expected—but coolest—parts of Safari 5 is the announcement that the application will support secure and signed extensions that run in the browser. Without seeing any of the documentation for the developer program (which we will detail when we get our hands on it), we can’t speculate too much on how deeply one might hook into Safari.

What we do know is that Apple has created a new “Safari Developer Program,” in which individual developers can enroll for free. Developers can then write extensions that are completely sandboxed from the main browser process (and presumably from other extensions) for security and stability reasons. Apple is following the lead of Firefox’s JetPack project and Chrome’s extension system by letting developers write their browser extensions in HTML5, CSS, and JavaScript as opposed to something more complex like Objective-C. In a break with the competition, though, it seems that Apple is requiring that all Safari Extensions go through the Apple Developer Program. The extensions will be cryptographically signed by Apple, and the browser will check to make sure that the extensions are signed properly before they can be used.

Creating a new Safari Extension.

Within Safari 5 is a tool called Extension Builder, which is apparently where developers will be able to perform the actual development of the extensions, as well as package and install them. It’s not yet clear how the distribution of these applications will take place. The existence of the Safari Developer Program and the requirement that all extensions must be signed by Apple before they go into the wild might indicate that Apple will exercise tight control over the market for these extensions and not allow them to be side-loaded into Safari (much like iPhone apps).

Update: After playing with Safari 5's extension builder, it does indeed look like you can just download extensions from the web or a developers website and load them into Safari.

At the Safari state of the union talk at WWDC, Panic's Cabel Sasser demoed what we believe is the first Safari Extension—a website annotation tool. Cabel details how they made the extension and their thoughts on the process on their blog.

Finally, we did notice that by default, extension support is disabled in Safari 5.

Bits and bobs

In addition to all the above, Apple has also updated the way it completes website addresses when you start typing in the Smart Address Field. In Safari 4, matches were only made against the URL of the sites in your history or bookmarks. Furthermore those matches we done against the beginning of the URL.

That is, if you were to start typing 't-e-c-h-n-i-c-a' into the Safari 4 address bar, you might not see matches for arstechnica.com. In Safari 5, matches are displayed when your text appears anywhere in the URL. In addition the page's titles will be searched to give even better matches.

If you want to run the new version, you must be running Mac OS X 10.5.8 or later if you’re on Leopard, or 10.6.2 or later if you’re on Snow Leopard. Windows users need Windows XP SP2 or higher to run Safari 5.