Pages

Thursday, March 24, 2016

Clearing cookies on browser close

In one of my project I had a requirement to clear all the session cookies set in my application on browser close. After exploring for a while I found out a simple configuration in WebLogic Server-specific deployment descriptor, weblogic.xml which will clear all the cookies on browser close. 

In session-descriptor section of weblogic.xml, there is a parameter, cookie-max-age-secs which sets the life span of the session cookie in seconds, after which it expires on the client. Setting this value to -1 expires the cookie on browser close.  Set this value as mentioned below.