How to disable the Android browser cache permanently?

Chris picture Chris · Mar 6, 2011 · Viewed 13.6k times · Source

I'm developing a web based application that also should run on Android based phones. As I don't have one I'm successfully using the emulator from the SDK.

But as I'm constantly changing some JavaScript pages of the application the browser uses the old versions out of it's cache (cache control on the server is right - but I'm not having there the normal use case where excessive caching is wanted)

So is there a way to tell the (default) Android Browser to permanently disable it's cache?
Or is it possible to use an adb command to clear the cache?

Answer

jfriend00 picture jfriend00 · Jun 27, 2011

For the duration of debugging, add a meta tag to your page to disable caching.

<META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE">
<META HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE">

http://www.i18nguy.com/markup/metatags.html