I observe this behaviour currently in Firefox 3.6.12:
When I start loading a page and then switch while it is still loading to another tab or window and come back when loading is finished, the “dom:loaded” event has not been triggered by the document observer.
Any ideas how to solve this?
It sounds like a bug in Firefox, you should report it to Mozilla. You could also try reporting it to the Prototype mailing list and they might find a solution for their next version. Both of these means waiting for a fix that might not come. But you should still report it as a bug for everyone’s benefit.
You could simply move your script to the very bottom of the page, although it will run sooner than “dom:loaded” the relevant parts of the DOM should be instantiated by then.
Or you could observe the body’s onLoad event, that will run later (after images are loaded) so is safer.