Search code examples
webviewappceleratortitanium-mobileappcelerator-titanium

Clear Cookies of WebView in Titanium


I am loading a website in Titanium webview. I can see all the cookies without any issue. Now I want to delete all the cookies.

Some forum have mentioned that we have to find '\Library\Cookies' folder and manually delete it, but I am worried if it delete entire Cookies. I want to delete cookies related to the webview. Can anyone suggest how I can achieve this?

Thanks


Solution

  • We have a few methods in titanium that can help to clear cookies, have a look at the below methods which can help you

    Titanium.Network.removeHTTPCookie, Titanium.Network.removeHTTPCookiesForDomain, Titanium.Network.removeAllHTTPCookies, Titanium.Network.removeSystemCookie, Titanium.Network.removeAllSystemCookies

    Let me know if any of that help you.

    EDIT (For Android)

    You can try the Titanium.Network.removeSystemCookie or Titanium.Network.removeAllSystemCookies, as in Android webView saves its cookies in system cookie store and it is not shared with the Titanium.Network.HTTPClient cookie store.

    Good Luck, cheers

    Ashish Sebastian