Click to See Complete Forum and Search --> : onLoad
Max^Power
12-10-2002, 03:21 AM
In my site, I would like that when a user enters in it he would get a confirm window by using the onload command in the body tag. However, i would like that this confirm box will not pop up everytime the user returns to the homepage, but only once for a session. Is this possible ?
Thanks
Sceiron
12-10-2002, 03:31 AM
There is some sample code at http://javascript.internet.com/cookies/only-popup-once.html
that essentially does exactly what you want, except with a popup window instead of a confirm() box. You could modify the popup window portion of the checkCount() function to do what you need.
Max^Power
12-10-2002, 03:46 AM
thanks for that script, it looks good. However, is there a simpler method .. without setting any cookies?
thanks
Sceiron
12-10-2002, 03:51 AM
In a word, no. Technically you COULD use a server-side script and serve up dynamically generated HTML using perl or PHP based on the IP address of the user, but that's a little extreme for your needs. Cookies are a wonderful thing for stuff like this. If the user doesn't have cookies enabled, then too bad for them.. they have to click OK every time they hit your site, oh the horror.
Max^Power
12-10-2002, 04:35 AM
ok thanks for your help! much appreciated.