Javascript to delete cookie on android web browser

android, cookies, javascript

Solution

I've seen browsers (actually in TV sets, but not sure which it was exactly), that did not accept the 'expires=' field (with an absolute date), but worked well with 'max-age=' (live-time in number of seconds from now). So maybe try to delete the cookie by:

document.cookie = 'cookiename=; max-age=0; path=/';

Problem

What is the javascript to delete a cookie on android web browser. The usual method of setting an expiration date of the cookie to a date in the past does not work in android web browser. For e.g. the below code works in desktop web browsers and mobile safari but does not work in android web browser. ``` document.cookie = 'cookiename=cookievalue; expires=Thu, 2 Aug 2001 20:47:11 UTC; path=/'; ```

Original source