Skip to content Skip to sidebar Skip to footer

Sticky Cookies In Scala

I've set a cookie in Scala similar to the following: val cookies:Seq[Cookie] = new Seq() val nDaysExpire:Int = 2000 val nSecondsExpire:Int = nDaysExpire * 24 * 60 * 60 val cookie:C

Solution 1:

According to the docs, the constructor for Cookie takes a boolean parameter named httpCookie. The default value is true.

HttpOnly cookies cannot be seen by javascript. So, if you want to delete your cookie from javascript, try setting this to false.

val cookie:Cookie = new Cookie(sCookieID, sValue, Option(nSecondsExpire), httpOnly = false)

By Jeff Atwoord in Protecting Your Cookies: HttpOnly

When you tag a cookie with the HttpOnly flag, it tells the browser that this particular cookie should only be accessed by the server. Any attempt to access the cookie from client script is strictly forbidden.

Post a Comment for "Sticky Cookies In Scala"