You're better off using a manifest file, which is part of the HTML5 spec. Not everything needs to be done in JavaScript =)
In the same vein, does the browser check if files specified in the manifest expired? If yes it would once again waste some time...