I want to delete all cookies from a webview
in an Alloy application.
I have found different solutions from other questions but none worked.
I have tried:
Ti.Network.createHTTPClient().clearCookies(MY_URL);
Ti.Network.removeHTTPCookiesForDomain(MY_URL);
var cookiesPath = Ti.Filesystem.applicationDataDirectory+'/Library/Cookies';
var file = Ti.Filesystem.getFile(cookiesPath);
if(file.exists()) file.deleteDirectory(true);
$.webview.evalJS('(function (){'+
'var cookies = document.cookie.split(";");' +
'for (var i = 0; i < cookies.length; i++) {' +
' var cookie = cookies[i];' +
' var eqPos = cookie.indexOf("=");' +
' var name = eqPos > -1 ? cookie.substr(0, eqPos) : cookie;' +
' document.cookie = name + "=;expires=Thu, 01 Jan 1970 00:00:00 GMT";' +
'}})();');