I have a Chrome App with a webview that has a 'persistent partition', I need to have a button that will clear all the data saved in that webview's partition. I've tried the following solution based on the official google samples but I can't get it to work
var clearDataType = {
appcache:true,
cookies: true,
fileSystems: true,
indexedDB: true,
localStorage: true,
webSQL: true,
}
function clearCache() {
document.getElementById('webview-window').clearData(
{ since: 0 }, // Remove all browsing data.
clearDataType, function() {console.log('cache cleared');});
}
The webview in the app is like this:
<webview id="webview-window" src="http://www.google.ca" partition="persist:cache1">
I'm getting the error: "uncaught typeError:...clearData is not a function" whenever I press the button that runs the clearCache() function above.
I've never worked with webviews this way before so any extra explanation would be much appreciated.