On Mon, Oct 7, 2019 at 12:32 PM Sibgha Nazir <sibgha...@gmail.com> wrote:
> > > > You don't use *expires *here. > > > Yes it is irrelevant. Please ignore it. > > > This should work. > > Check what are the response headers in Chrome's Dev Tools > Network. The > > new max-age value must be set to 0. > > > I went to chrome dev tool -> network. But i cannot see whats max-age and > where to look for it. > You may need to research how Cookies actually work. Cookies are just data in the HTTP request/response headers. If there is no Set-Cookie response header then most probably the Wicket WebResponse you have used when calling #clearCookie() is not the one that has been used to deliver the HTML response. Most probably your application has replaced the response object with another one without preserving the already set headers. > > > On Mon, Oct 7, 2019 at 9:15 AM Martin Grigorov <mgrigo...@apache.org> > wrote: > > > Hi, > > > > On Mon, Oct 7, 2019 at 3:14 AM Sibgha Nazir <sibgha...@gmail.com> wrote: > > > > > Hi, > > > > > > I set a cookie from JavaScript in the chrome browser like > > > > > > > var d = new Date(); > > > > d.setTime(d.getTime() + (exdays * 24 * 60 * 60 * 1000)); > > > > var expires = "expires=" + d.toUTCString(); > > > > document.cookie = "test=true;1;path=/"; > > > > > > > You don't use *expires *here. > > > > > > > > > > > > > So the cookie value in the chrome is "true" (cookie "test"="true") > > > > > > then I am trying to clear the cookie in the wicket like > > > > > > WebRequest webRequest = (WebRequest) RequestCycle.get().getRequest(); > > > > > > WebResponse webResponse = (WebResponse) > RequestCycle.get().getResponse(); > > > > > > Cookie cookietest = webRequest.getCookie("test"); > > > > webResponse.clearCookie(cookietest); > > > > > > > This should work. > > Check what are the response headers in Chrome's Dev Tools > Network. The > > new max-age value must be set to 0. > > > > > > > > > > > > > The cookie is not deleted. I run the wicket web app on tomcat server. > > Does > > > anyone know what could be wrong? > > > > > > > > > Just to be clear the cookie we set with JavaScript and the cookie we > > > retrieve in wicket is pointing to the same space? I am confused why it > > > wouldn't work. Does it have to anything with the Tomcat server? > > > > > > Best Regards, > > > Sibgha Nazir > > > > > >