Expiring Cookies when the Browser is Closed

Hi,

The answer to this is probably a one line, but i can't find it
anywhere.

How do I make a cookie expire when a browser is closed (ie when the
session ends)? The expiry key in the cookie hash only seems to take
dates.

Thanks,
Scott

The answer to this is probably a one line, but i can't find it
anywhere.

How do I make a cookie expire when a browser is closed (ie when the
session ends)? The expiry key in the cookie hash only seems to take
dates.

Set it to a date in the past... like 1.day.ago

Actually, if you set a cookie without giving an expiration date, it is only retained until the browser is closed. (Which can mean the program itself, not just a window or a tab.)

An expiration in the past will delete the cookie immediately.

-Rob

Rob Biedenharn http://agileconsultingllc.com
Rob@AgileConsultingLLC.com
Skype: rob.biedenharn