1

I need to display a popup to the user once per session. My thought was to create a session cookie by creating a cookie with no expiration date to track if the popup has already been displayed. These cookies should be removed when the browser is closed. I have since learned that Chrome has a "feature" where session cookies are not removed (Chrome doesn't delete session cookies).

I am not asking why the cookies aren't deleted in chrome. I am asking if there is a way to force chrome to remove the cookies or some other solution to only display a popup once per session.

Community
  • 1
  • 1
Spencer
  • 116
  • 2
  • 9

1 Answers1

0

You can maybe use sessionStorage to store your flag? http://www.w3schools.com/html/html5_webstorage.asp

Or is this information required to be sent to the server on every request?

jorge.alonso
  • 289
  • 2
  • 5
  • This works for me. I check if the browser supports storage, if it does then i use it. if it doesn't then it isn't chrome and the cookies will expire after the session – Spencer Apr 24 '14 at 17:44
  • If you have "Continue where I left off" checked, the sessionStorage will persist between restarts, leaving you with the same problem. – Josh Whitlow Jun 15 '17 at 14:45