views:

21

answers:

1

Is it possible to have a webpage where on buttonClick, JQuery goes fetches a certain few URLs to MIDI files, and instead of them playing automatically, they are played on demand ?

<a href="bach.mid">Bach</a>
<a href="beethoven.mid">Beethoven</a>

I want to be able to eagerly fetch them into an array of objects and play them on demand.

 midis[0].play// or something like that
+1  A: 

Assuming those MIDI files are static content, you can set the cache-control of those files to private in the hosting environment to make them able to cache in the browser local file cache once downloaded.

Make an array with the name of the MIDI files and just loop through them with AJAX code to download / pre-load them (no special code is needed, just download) before you need to play them. Since the MIDI would be in the browser cache after you pre-load them, you should be able to play them when you need to. The browser will be smart enough to pick up those files from the file cache (if the cache is cleared by the user, it will download it again from the server).

airmanx86
The cache-control can be public as well, the different is that when setting it to private - the file will not be cached by proxy server in between the server and the user.
airmanx86