This week's giveaway is in the Spring forum.
We're giving away four copies of Microservices Testing (Live Project) and have Chris Love & Andres Sacco on-line!
See this thread for details.
Win a copy of Microservices Testing (Live Project) this week in the Spring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Mikalai Zaikin
  • Himai Minh

Cookie not recognized

 
Ranch Hand
Posts: 121
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Requirement: A pop-up has to be shown only once when the user navigates to our page. I have written a javascript that sets a cookie (with expiry time 3 months from now) when the pop-up is shown. This javascript will be called whenever the user clicks on a link. If the cookie is set, the pop-up will not be shown. If not, the pop-up will pop-up :roll:

Problem: The cookie is not being recognized properly. Sometime, it is and at other times, it is not. This results in the pop-up opening randomly many number of times. My guess is the expiry time is not being set properly.

Any suggestions?
 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Problem is with expiry time..Try to have a flag in the cookie and use that to determine to invoke the pop-up or not.Just a suggestion.
 
Sravan Kumar
Ranch Hand
Posts: 121
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Any idea where this cookie will be stored in the system? I cannot set a flag in the cookie as I can set only a name=value pair with options according to the specifications.

And most of the sites I checked out said I can only get the value of a cookie, given the name. Any idea how I can see the set expiry time?
 
Prathiba Kalirengan
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Flagging the cookie->Create a flag cookie and parse the cookie to get the flag value
 
Sravan Kumar
Ranch Hand
Posts: 121
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Thanks, but that is what I essentially meant by reading / writing from / to the cookie before I show the pop-up.

And I have checked out the expiry time. It is set properly. And the problem is kind-of narrowed; When I read the cookie, I do not always get the latest value that I stored. It gives me value(s) that I stored at earlier tries. Any solutions for this behavior?
 
Prathiba Kalirengan
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
HTTP 1.0 does not cache pages that use cookies created with this class.so change the version of HTTP
 
reply
    Bookmark Topic Watch Topic
  • New Topic