This is my personal blog. The views expressed on these pages are mine alone and not those of my employer.

Wednesday, September 21, 2005

onDOMLoad

[via Keebler/Blog]

Most people attach their initialization behavior to an onload event, waiting for the page to finish loading before manipulating the DOM. One problem with this, though, is that onload doesn't fire until everything on the page is finished loading, including all images. It can take several seconds, or more, for every image to load, especially on Internet Explorer since there is a two connection per host limit.

The folks at brothercake have posted a nifty onDomLoad script that solves this problem:

"domFunction is an easy-to-use helper script, that allows other DOM scripting to run before window.onload; the practical benefit is that javascript doesn't have to wait for images or other dependencies to finish loading anymore - it can begin as soon as the DOM is ready."

Check it out.

Finished O'Reilly Network Article

Whew, just finished and pushed my O'Reilly Network article out to the O'Reilly publishers; that was ALOT of work.

The article is titled "AJAX: How to Handle Bookmarks and Back Buttons." Here's a sneak peak on the intro; you'll have to wait until O'Reilly publishes the article to see the full thing ;)

"This article presents an open source JavaScript library that finally brings bookmarking and back button support to AJAX applications. By the end of this tutorial developers will have a solution to an AJAX problem that not even Google Maps or Gmail possesses: robust, usable bookmarking and back and forward behavior that works exactly like the rest of the web.

"AJAX: How to Handle Bookmarks and Back Buttons" discusses the significant issues that AJAX applications currently face with bookmarks and the back button; delivers an open source library created exclusively for this article that solves these problems; and presents serveral working examples.

The principal discoveries of the framework presented in this article are two-fold. First, we use a hidden HTML form to allow for a large transient session cache of client-side information which is robust against navigation to and away from the page. Second, we use a combination of hyperlink anchors and hidden iframes to intercept and record browser history events, tying into the back and forward buttons. Both techniques are wrapped with a simple JavaScript library to ease development."

Special thanks to everyone who reviewed the article and the Really Simple History framework: Michael Eakes, Jeremy Sevareid, David Barrett, Brendon Wilson, Dylan Parker, Erik Arvidsson, Adam Fisk, Alex Lynch, Joseph Hoang Do, Richard MacManus, Garret Wilson,
Alex Russell, Ray Baxter, Chris Messina, and David Weekly.

My next step is an article for the O'Reilly Network on long term permanent storage for AJAX applications. Like the last article, this will include an open source framework that allows AJAX applications to store data locally beyond the 4K limit of cookies. The basic approach is to use a hidden flash file that I wrap with a nice, hash table like JavaScript API; I've already prototyped the basic approach so I know it works. Internally, I use some special abilities in Flash to store arbitrary amounts of content locally long term. I think the example application in the article will be an simple AJAX word processor that can save files locally.

This page is powered by Blogger. Isn't yours?

Subscribe to Posts [Atom]