Coldfusion cfscript cookies will not allow empty expiration

I am trying to use cfscript cookies in CF10 to set a cookie that should be deleted when the browser closes. I can do this with set-headeror <cfcookie>, but could not do it with a struct cookie approach.

Does anyone know of a better workaround than using set-header? (staying inside cfscript tags)

<cfscript>
    // Set-Cookie:TEST1=hello; Expires=Sun, 07-Aug-2044 17:51:26 GMT; Path=/; HttpOnly
    cookie.test1 = {value="hello", httponly=true};

    // Set-Cookie:TEST3=hello; Expires=Thu, 01-Jan-1970 00:00:10 GMT; Path=/; HttpOnly
    cookie.test3 = {value="hello", httponly=true, expires="0"};

    // Set-Cookie:TEST4=hello; Expires=Thu, 01-Jan-1970 00:00:10 GMT; Path=/; HttpOnly
    cookie.test4 = {value="hello", httponly=true, expires="-1"};

    // this throws an exception
    //cookie.test5 = {value="hello", httponly=true, expires=""};
</cfscript>

<!--- Set-Cookie:TEST2=hello2; Path=/; HttpOnly --->
<cfcookie name="test2" value="hello2" httponly="true">
+4
source share
1 answer

, Chrome Firefox. . Chrome cookie , , . Firefox. IE, . . , max-age. cookie max-age. Chrome Firefox. IE max-age, . , cookie . Safari. : cookie firefox

cookie chrome

+1

All Articles