There is no actual preloading of sound files in javascript or HTML. There may be a way with Flash, Java (not javascript), or a server side language, I don't know. You can place an embed on a page with the sound file as its src attribute and set it hidden and not to play, that will preload it - sort of. But there is no way to monitor its progress as there is with images. And, if you are preloading images, they will be taking up the bandwidth anyway, so the sound file may not load until after.
However, if the embed 'runs' before the preload script, the script may wait for the sound file to load before starting on the images. At least a few images will probably load concurrently, so it is a bit of a crap shoot, but you might luck out.
Example hidden non-starting embedded wav tag:
Code:
<embed src="mysound.wav" loop="false" autostart="false" hidden="true">
If that happens, it may take some time (depending upon connection speed and the size of the sound file), but at least then the progress bar will not start moving until the browser starts in on the images.
The best chance of that happening is to put the embed tag in the body of the page and to change this in the second part of the preload script:
to:
Code:
window.onload = loadImages;
Bookmarks