I had used the Cordova 3.6.3 version for building my android app and i wnat to disable the caching of URL in cordova webview , I am using the default cordova project for that purpose and using the index.html file. I tried this but it is crashing my app
public class MyClass extends CordovaActivity
{
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
mwebview=(WebView) findViewById(R.id.appView);
WebSettings ws=mwebview.getSettings();
ws.setAppCacheEnabled(false);
ws.setCacheMode(WebSettings.LOAD_NO_CACHE);
// Set by <content src="index.html" /> in config.xml
loadUrl(launchUrl);
}
}
cordova-disable-http-cache
Cordova plugin to completely disable caching of HTTP requests and responses.
Just type this command in your Cordova CLI:
cordova plugin add cordova-disable-http-cache
This will fetch plugin "cordova-disable-http-cache" via npm and install "cordova-disable-http-cache" for android.
It solved my problem with disabling cache in my application. My cordova version is 6.5.0.
Cordova (due to running on top of webview) respects the nocache header, if you're able to set that in your server it should give you the same result. Plus you can control the use of the cache itself through expirations and the like.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With