We are adding a feature to our Cordova app to catch unhandled exceptions and restart the app. We would like the browser history to be cleared in this case so the user can't hit back on an Android device to go back to the screen that crashed.
It isn't possible to clear the browser history programmatically, but I expected there to be a Cordova plugin that reinstantiates the whole app (i.e. deletes the current webview and creates a new one). I wasn't able to find anything like this though.
Is there a good way to do this that will work on both iOS and Android?
In Android for every WebView
instance you can do:
webView.clearCache(true);
webView.clearHistory();
webView.clearFormData();
For IOS please read here: Clearing UIWebview cache
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