David
David

Reputation: 4895

Can I tell Web Browsers to not cache a specific file?

Can I tell Web Browsers to not cache a specific file ?

eg :

<audio src="myAudio.wav" cache="false"> </audio>

If so, how ?

This <meta http-equiv="cache-control" content="no-cache" /> tells Web Browsers to not cache all files. That is not what I'm looking for.

Upvotes: 1

Views: 706

Answers (1)

alex
alex

Reputation: 490647

When your web server serves myAudio.wav, set some headers to tell the browser not to cache the file.

Cache-Control: no-cache, no-store, must-revalidate
Pragma: no-cache
Expires: <a paste date>

For documentation of the date format, see this RFC (thanks cHao).

Alternatively, append a timestamp as a GET paramater, e.g. myAudio.wav?time=39038392832.

Upvotes: 6

Related Questions